摘要:
原文地址http://blog.csdn.net/guirenwang/article/details/2611355this指针只能在一个类的成员函数中调用,它表示当前对象的地址。下面是一个例子: void Date::setMonth( int mn ) { month = mn; // 这三句是等价的 this->month = mn; (*this).month = mn; }1. this只能在成员函数中使用。 全局函数,静态函数都不能使用this。 实际上,成员函数默认第一个参数为T*const register this。如: class A{public... 阅读全文
posted @ 2012-05-31 11:47
alaigle
阅读(403)
评论(0)
推荐(0)

浙公网安备 33010602011771号