Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What does the -&gt means?

Status
Not open for further replies.

MindCracker

Programmer
Aug 27, 2002
21
0
0
GB
Hi,

Can anyone tell me what -&gt means? For example, I have this code:

CMyDoc*pDoc=(CMyDoc*)m_pDocTemp->CreateNewDocument();
ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(CMyDoc)));

What is the -&gt trying to tell?

many thanks!

cheers,
 
It is a member selection operator.
If you have a pointer to an object, you can address the individual members of that object using the operator.
/JOlesen
 
the -> is an operator for accessing members of a pointer. For example, when you have a regular object such as a class or struct, you would normally access its members and functions by using the '.' (period) operator, eg.

MyClass someObject; // a regular object

someObject.SomeFunction();
// accessing a member function of the object using
// the '.' operator


Now, suppose you have a pointer to the object instead. You would use the '->' operator instead of the period, eg:

// create a pointer to an object
MyClass* someObjectPtr = new MyClass;

// accessing a member function of the object using
// the -> operator

someObjectPtr->SomeFunction();


Many of the MFC class member functions will return pointers to objects, in which case you'll need to use the -> operator when accessing their members. For example:

// Get a pointer to a parent window
CWnd* pParent = GetParent();

// now do something useful with the pointer
pParent->UpdateWindow();

:)
 
Oh,

I am sorry, something is wrong with the display. I was trying to say -&gt instead. For example, I have this code:

CMyDoc*pDoc=(CMyDoc*)m_pDocTemp-&gt->CreateNewDocument();
ASSERT(pDoc-&gt->IsKindOf(RUNTIME_CLASS(CMyDoc)));

What is the "-&gt" trying to tell?

Sorry for the confusion... many thanks!

 
Hey,

Something is wrong again... Perhaps the display does not support "- & gt". What I mean is:

CMyDoc*pDoc=(CMyDoc*)m_pDocTemp- & gt->CreateNewDocument();
ASSERT(pDoc- & gt->IsKindOf(RUNTIME_CLASS(CMyDoc)));

What is the "- & gt" trying to tell?

Sorry for the confusion... many thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top