[Chapter III] c ++ study notes 1 (this pointer)


this pointer action, its role is to point to a member function is a function of the object
using the embodiment

in order to return c1, use this pointer to point to the role the object

using a null pointer calls hello, hello call to be allowed to act on the object pointed to by p, but p did not point to any object, but was able to normal output
void the Hello () {COUT << "Hello" << endl} -void the Hello (A * the this) {COUT << "Hello" << endl}
P-the Hello () - Hello (p)

Guess you like

Origin www.cnblogs.com/lamia76/p/12324447.html