特别注意:英文基本是自己编的,语法或词汇极可能不对,只是做我自己学习英语习惯写在下面了.
1.友元函数没有this 指针,因为友元函数不是类的成员函数.
Friend functions do not have a this pointer, because friends are not members of a class.
2.静态成员函数没this指针
Static member functions do not have this pointer.
3.在C++编程中,何时会用到this指针?
When should you use the 'this' keyword in c++?
a.删除类对象的时候
free objects. such as : if( null != this ){ do some stuff ;} delete this; this = null;
b. 重载操作符的时候
the this pointer is very important when operators are overloaded. Such as : myclass operator ++(){ ++i; return *this;}