C++ examples for Class:this
Using this pointer referring to data
#include <iostream> using namespace std; class what//from w w w. java 2 s . c o m { private: int alpha; public: void tester() { this->alpha = 11; //same as alpha = 11; cout << this->alpha; //same as cout << alpha; } }; int main() { what w; w.tester(); cout << endl; return 0; }