cplusplus

C++学习

上一篇 / 下一篇  2011-06-21 22:22:15 / 个人分类:VC

C++类的指针:

#include <windows.h>
#include <stdio.h>

class CFather
{
public:
 CFather()
 {
  pThis = this;
 };

 ~CFather()
 {

 }

 CFather *pThis;
 virtual void Test()
 {
  printf("this is father\n");
 }

 void Test2()
 {
  pThis->Test();
 }
};

class CChild : public CFather
{
public:
 virtual void Test()
 {
  printf("this is child\n");
 } 
};

CChild cld;

int main(int argc, char* argv[])
{
 cld.Test2();
 return 0;
}


TAG:

chelingying的个人空间 引用 删除 chelingying   /   2011-06-22 14:23:53
3
 

评分:0

我来说两句

Open Toolbar