Thursday, July 30, 2009

In C++, Can u explain how to use pointers to call variables by reference when using classes?

Give some examples...


useful references...

In C++, Can u explain how to use pointers to call variables by reference when using classes?
This is a pretty basic question, and I suggest you get a better understanding of pointers in general because they are a key part to C/C++.





Start by reading this:


http://www.cplusplus.com/doc/tutorial/po...
Reply:CMyClass


{


public:


int m_nValue;


};





void MyFunc()


{


CMyClass MyClass;


IncValue(%26amp;MyClass);


}





void IncValue(CMyClass* pMyClass)


{


pMyClass-%26gt;m_nValue++;


}
Reply:Can I have some money now please ?


No comments:

Post a Comment