Click here to Skip to main content
15,898,134 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Where does VS 6.0 stores the path of a file ? Pin
567890123415-Jan-04 2:53
567890123415-Jan-04 2:53 
GeneralReally Dumb (easy) Question Pin
Roger Wright14-Jan-04 20:28
professionalRoger Wright14-Jan-04 20:28 
GeneralRe: Really Dumb (easy) Question Pin
StHubi14-Jan-04 20:54
StHubi14-Jan-04 20:54 
GeneralRe: Really Dumb (easy) Question Pin
Cyberizen14-Jan-04 20:54
Cyberizen14-Jan-04 20:54 
GeneralRe: Really Dumb (easy) Question Pin
lobanovski14-Jan-04 20:55
lobanovski14-Jan-04 20:55 
GeneralRe: Really Dumb (easy) Question Pin
alex.barylski14-Jan-04 20:57
alex.barylski14-Jan-04 20:57 
GeneralRe: Really Dumb (easy) Question Pin
Roger Wright14-Jan-04 21:28
professionalRoger Wright14-Jan-04 21:28 
GeneralRe: Really Dumb (easy) Question Pin
Antti Keskinen14-Jan-04 22:07
Antti Keskinen14-Jan-04 22:07 
Well, perhaps I'll add my knowledge to the heap.

Consider the following: you have an object of some type. Let's name this type 'Roger', and let it have an attribute called 'Age' (No sarcasm intended !)

Now, if in your code, you created a static object, you would use Roger MyRoger declaration. This would create a static object for you. You would then access the member variable by using MyRoger.Age = 30, for example.

Let's take a step beyond and consider a pointer. See in front of yourself a 3D-space. In this space, you see the MyRoger-object standing at some point. Then, you create a pointer of type Roger using a declaration Roger* pToMyRoger = &MyRoger. Now, the pToMyRoger pointer points towards the MyRoger object, just like an extended finger.

A static object is aware of two things: what it is, and where it resides. A pointer to any object is aware of two things as well: where it resides, and what is to be found in that location.

For a more in-depth scenario, consider that your Roger-object (MyRoger) reserves a place for itself in memory (&MyRoger). If you issued MyRoger.Age, the compiler would get the address of MyRoger, move forwards from there to the Age variable, and retrieve it's contents. If you used a pointer, then the compiler would take the address you give to that pointer, and ASSUME that the object found from that address is the one specified by the type of the pointer (Roger*). It would then search for the Age variable again, and retrieve it.

Then to the term 'dereferencing'. When you have pointer to the object Roger (pToMyRoger), you can dereference it to an OBJECT of type Roger by using the asterisk (*) operator. For example, this declaration (*pToMyRoger).Age is the same thing as MyRoger.Age. As you might guess, *pToMyRoger equals to MyRoger hence leading us to the following conclusion: the dereferencing operator (*) can sometimes be named as the 'contents-of' operator. Thus, the contents of pToMyRoger (*pToMyRoger) equals to the object MyRoger (MyRoger). Does this make sense ?

In the conclusion, the '.' and the '->' operators behave similarly, but they are used in different contexts. For example, the following declarations do all the same things

MyRoger.Age = (*pToMyRoger).Age = pToMyRoger->Age = (&MyRoger)->Age

I am not sure about the final declaration, as I have never tested it. But, it should work according to the C++ language syntax, to which we will not dive right now Big Grin | :-D

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: Really Dumb (easy) Question Pin
Roger Wright15-Jan-04 4:30
professionalRoger Wright15-Jan-04 4:30 
GeneralRe: Really Dumb (easy) Question Pin
alex.barylski14-Jan-04 22:46
alex.barylski14-Jan-04 22:46 
GeneralRe: Really Dumb (easy) Question Pin
[James Pullicino]15-Jan-04 1:35
[James Pullicino]15-Jan-04 1:35 
GeneralRe: Really Dumb (easy) Question Pin
Roger Wright15-Jan-04 4:32
professionalRoger Wright15-Jan-04 4:32 
GeneralRe: Really Dumb (easy) Question Pin
David Crow15-Jan-04 7:58
David Crow15-Jan-04 7:58 
GeneralRe: Really Dumb Reply Pin
Monty215-Jan-04 0:14
Monty215-Jan-04 0:14 
Generalfilter control like Outlook Express message rules Pin
quzi14-Jan-04 20:07
quzi14-Jan-04 20:07 
General32 and 64 bits Pin
lobanovski14-Jan-04 20:07
lobanovski14-Jan-04 20:07 
GeneralRe: 32 and 64 bits Pin
alex.barylski14-Jan-04 21:07
alex.barylski14-Jan-04 21:07 
GeneralRe: 32 and 64 bits Pin
lobanovski14-Jan-04 21:28
lobanovski14-Jan-04 21:28 
GeneralRe: 32 and 64 bits Pin
alex.barylski14-Jan-04 23:02
alex.barylski14-Jan-04 23:02 
GeneralMFC Models for ArgoUML Pin
StHubi14-Jan-04 19:53
StHubi14-Jan-04 19:53 
Generalworker thread communicate with user interface Pin
zecodela14-Jan-04 19:30
zecodela14-Jan-04 19:30 
GeneralRe: worker thread communicate with user interface Pin
Abhishek Srivastava14-Jan-04 22:46
Abhishek Srivastava14-Jan-04 22:46 
GeneralHELP!! VS.NET namespaces are driving me nuts... Pin
Nik Vogiatzis14-Jan-04 19:16
Nik Vogiatzis14-Jan-04 19:16 
GeneralSaving ColeServerDoc Pin
kevcs214-Jan-04 17:43
kevcs214-Jan-04 17:43 
QuestionHow to close Afxmessageboxes and dialogs belonging to a particular window Pin
Raghunandan S14-Jan-04 16:46
Raghunandan S14-Jan-04 16:46 

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.