摘要: virtual与static不能同时作用于一个函数。根据面向对象的理论,virtual的成员函数是可以变子类覆盖的,是实现多态的重要手段。而static作用的成员函数表示该函数仅属于某个类。下面是实验的代码:class A{ static virtual int Get() { return ... 阅读全文
posted @ 2014-08-13 16:12 lichongbin 阅读(1955) 评论(0) 推荐(0) 编辑
摘要: this指针指向的是对象的地址,与对象第一个成员变量的关系是怎样的呢?看下面这个例子:struct CPlex{ CPlex* pNext; void* data() { return this+1; }};int main(int argc, char* argv[]){ CPlex p; voi... 阅读全文
posted @ 2014-08-13 14:04 lichongbin 阅读(225) 评论(0) 推荐(0) 编辑