Click here to Skip to main content
15,895,011 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalstrange problem with activex control Pin
safee ullah23-Dec-03 0:22
safee ullah23-Dec-03 0:22 
GeneralRe: strange problem with activex control Pin
Monty223-Dec-03 1:12
Monty223-Dec-03 1:12 
GeneralTricky Question Pin
SiddharthAtw22-Dec-03 23:59
SiddharthAtw22-Dec-03 23:59 
GeneralRe: Tricky Question Pin
jhwurmbach23-Dec-03 0:14
jhwurmbach23-Dec-03 0:14 
GeneralRe: Tricky Question Pin
Ian Darling23-Dec-03 0:16
Ian Darling23-Dec-03 0:16 
GeneralRe: Tricky Question Pin
Monty223-Dec-03 1:08
Monty223-Dec-03 1:08 
GeneralRe: Tricky Question Pin
SiddharthAtw23-Dec-03 1:59
SiddharthAtw23-Dec-03 1:59 
GeneralRe: Tricky Question Pin
Ian Darling23-Dec-03 2:14
Ian Darling23-Dec-03 2:14 
SiddharthAtw wrote:
Please, I know what U told is correct but not able to understand 'you don't need to dereference this'.

When you call a member function, that function has access to an intrinsic pointer called "this", which is a pointer the object you called the method on.

So in a hypothetical example:

// we have some class called c

int main()
{
  c myObject;
  myObject.a();  // the this pointer in a() below will be &myObject
  c *myPointer = new c;
  myPointer->a(); // the this pointer in a() below will point to the same object as myPointer
  c *myNullPointer = 0;
  myNullPointer->a(); // the this pointer in a() below is null, so accessing i through it will result in an access violation.
}

void c::a()
{
  // these two lines are equivalent.  When referring to a member variable in a
  // member function, there is an implicit "this->" before it.
  this->i = 1;
  i = 1;
}


--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
GeneralRe: Tricky Question Pin
SiddharthAtw23-Dec-03 18:11
SiddharthAtw23-Dec-03 18:11 
GeneralHow can u initialize member variable while declaring??? Pin
abudu23-Dec-03 1:14
abudu23-Dec-03 1:14 
GeneralRe: How can u initialize member variable while declaring??? Pin
SiddharthAtw23-Dec-03 2:04
SiddharthAtw23-Dec-03 2:04 
Generalfirst feed the pointers Pin
abudu23-Dec-03 17:14
abudu23-Dec-03 17:14 
GeneralRe: Tricky Question Pin
nde_plume23-Dec-03 4:13
nde_plume23-Dec-03 4:13 
Generalprinter problem Pin
skpanda22-Dec-03 23:52
skpanda22-Dec-03 23:52 
GeneralOutlook add in - need guru's help Pin
YaronNir22-Dec-03 23:23
YaronNir22-Dec-03 23:23 
GeneralDatabase file index error Pin
Shanmuga Sundar22-Dec-03 23:19
Shanmuga Sundar22-Dec-03 23:19 
Generalrequired info about projects in c++ Pin
ammad ami22-Dec-03 22:54
ammad ami22-Dec-03 22:54 
GeneralRe: required info about projects in c++ Pin
Brian Shifrin23-Dec-03 5:58
Brian Shifrin23-Dec-03 5:58 
QuestionVisual C++ link with Visual basic 6? Pin
Anonymous22-Dec-03 21:56
Anonymous22-Dec-03 21:56 
AnswerRe: Visual C++ link with Visual basic 6? Pin
jhwurmbach22-Dec-03 22:43
jhwurmbach22-Dec-03 22:43 
AnswerRe: Visual C++ link with Visual basic 6? Pin
Anthony_Yio23-Dec-03 1:09
Anthony_Yio23-Dec-03 1:09 
GeneralPlease help on how to update my Platform SDK! Pin
twing22-Dec-03 21:32
twing22-Dec-03 21:32 
GeneralRe: Please help on how to update my Platform SDK! Pin
Michael P Butler23-Dec-03 1:01
Michael P Butler23-Dec-03 1:01 
GeneralRetreive the conent MFC Active Document Server Pin
Member 52603722-Dec-03 19:33
Member 52603722-Dec-03 19:33 
GeneralRetreive the conent MFC Active Document Server Pin
Member 52603722-Dec-03 19:09
Member 52603722-Dec-03 19:09 

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.