alaigle

prepare yourself to change the world!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

2012年5月31日

摘要: 原文地址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)