摘要: 类的this指针有以下特点:(1)this只能在成员函数中使用。全局函数、静态函数都不能使用this.实际上,成员函数默认第一个参数为T * const this。如:class A{ public: int func(int p) { }};其中,func的原型在编译器看来应该是: int func(A * const this,int p);(2)由此可见,this在成员函数的开始前构造,在成... 阅读全文
posted @ 2010-11-05 20:05 瓜蛋 阅读(591) 评论(0) 推荐(1) 编辑
摘要: /*there are these several people: student teacher office_worker student_teacher*/#include <iostream>using namespace std;class people{public: people(const char*n) { name=new char[strlen(n)+1]; ... 阅读全文
posted @ 2010-11-05 02:18 瓜蛋 阅读(364) 评论(0) 推荐(0) 编辑
摘要: 以后晚上不再打游戏! 阅读全文
posted @ 2010-11-05 01:41 瓜蛋 阅读(161) 评论(0) 推荐(0) 编辑