Click here to Skip to main content
16,010,351 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMicrosoft !!! Q's Pin
suiram4011-Jun-04 6:49
suiram4011-Jun-04 6:49 
GeneralRe: Microsoft !!! Q's Pin
Maximilien11-Jun-04 6:55
Maximilien11-Jun-04 6:55 
GeneralRe: Microsoft !!! Q's Pin
David Crow11-Jun-04 7:28
David Crow11-Jun-04 7:28 
GeneralRe: Microsoft !!! Q's Pin
Maximilien11-Jun-04 7:29
Maximilien11-Jun-04 7:29 
GeneralRe: Microsoft !!! Q's Pin
suiram4011-Jun-04 7:39
suiram4011-Jun-04 7:39 
GeneralRe: Microsoft !!! Q's Pin
David Crow11-Jun-04 8:06
David Crow11-Jun-04 8:06 
GeneralRe: Microsoft !!! Q's Pin
Henry miller11-Jun-04 8:03
Henry miller11-Jun-04 8:03 
GeneralRe: Microsoft !!! Q's Pin
jj3pa11-Jun-04 14:21
jj3pa11-Jun-04 14:21 
<snip>
1. How they can call a type(class name) CObject.
As long an object is an instance of a class,
How they can call a class 'CObject' ???


The idea is that all objects in MFC are based on it ... much as object in Java and C#

<snip>
2. Extreme encapsulation!!!
-I've seen this in MFC/ATL implementations:
If they have C++ classes usually they make data members
private and provides public functions for access
Them as read/write (Set***(), Get***), so instead writing
obj.member=5; you write obj.SetMemebr(5); and
type t = obj.member; you write type t = obj.GetMember().
-On the other hand when you use some COM components type libraries
By default (!raw_interfaces_only) they wrap the ccom_ptr
In the *.tli generated files around the interfaces 'transforming'
The interface method calls (__declspace(propput=)...)
po->SetVar(type) into po->_var=type; which is the other way around.
So finally the cool thing is when we have the possibility of right member access we wrap function calls and when we have function calls
We wrap direct member access call. Isn’t this weird?


As others have said its good style to have setters and getters, especially for setters ... Maybe you want a member to be restricted to 1..100 .. How would you do that otherwise ?

Maybe you have a member that constantly needs to be refreshed ... say the exchange rate for Euros to US Dollars. Just returning the current value stored would do no good, and constantly updating the value may be inefficent ... so just make sure you have the current value when you need it.

This is dealt with in other languages via properties ... getters and setters kinda hidden in the syntax.
GeneralRe: Microsoft !!! Q's Pin
toxcct13-Jun-04 3:28
toxcct13-Jun-04 3:28 
Generalreading and writing to a file outside of my programming Pin
kyleiscool200411-Jun-04 6:40
kyleiscool200411-Jun-04 6:40 
GeneralRe: reading and writing to a file outside of my programming Pin
jmkhael11-Jun-04 6:47
jmkhael11-Jun-04 6:47 
GeneralRe: reading and writing to a file outside of my programming Pin
Navin11-Jun-04 8:02
Navin11-Jun-04 8:02 
Generalsending messages within an application. Pin
Anonymous11-Jun-04 5:39
Anonymous11-Jun-04 5:39 
GeneralRe: sending messages within an application. Pin
David Crow11-Jun-04 6:31
David Crow11-Jun-04 6:31 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 7:20
Anonymous11-Jun-04 7:20 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 7:30
Anonymous11-Jun-04 7:30 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 7:48
Anonymous11-Jun-04 7:48 
GeneralRe: sending messages within an application. Pin
David Crow11-Jun-04 8:00
David Crow11-Jun-04 8:00 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 8:32
Anonymous11-Jun-04 8:32 
GeneralRe: sending messages within an application. Pin
David Crow11-Jun-04 8:40
David Crow11-Jun-04 8:40 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 8:57
Anonymous11-Jun-04 8:57 
GeneralRe: sending messages within an application. Pin
David Crow11-Jun-04 9:36
David Crow11-Jun-04 9:36 
GeneralRe: sending messages within an application. Pin
Anonymous14-Jun-04 3:51
Anonymous14-Jun-04 3:51 
GeneralPassing cdc across threads Pin
Member 51425211-Jun-04 5:35
Member 51425211-Jun-04 5:35 
GeneralRe: Passing cdc across threads Pin
palbano11-Jun-04 5:41
palbano11-Jun-04 5:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.