上一页 1 2 3 4 5 6 7 8 9 10 ··· 16 下一页

2015年6月10日

虚函数sizeof以及简单虚函数表

摘要: 1 /* cpp面试题 虚函数指针表的地址 */ 2 3 #include 4 5 using namespace std; 6 7 class myclass 8 { 9 public:10 virtual void run1()11 {12 cout <<... 阅读全文

posted @ 2015-06-10 10:42 Dragon-wuxl 阅读(135) 评论(0) 推荐(0)

虚函数重载以及虚函数特色必须this指针

摘要: 1 /* 虚函数重载特色以及虚函数特点 */ 2 3 #include 4 5 using namespace std; 6 7 class A 8 { 9 public:10 // 虚函数靠this指针的转换来实现,必须是成员函数11 // 虚函数不可以是外部函数 不可以... 阅读全文

posted @ 2015-06-10 10:29 Dragon-wuxl 阅读(207) 评论(0) 推荐(0)

构造与析构函数是否可以是虚函数

摘要: 1 /* 构造与析构的虚函数问题 */ 2 3 #include 4 5 using namespace std; 6 7 class ye 8 { 9 public:10 ye()// 禁止构造函数是虚函数11 {12 p1 = new char[1024*... 阅读全文

posted @ 2015-06-10 09:53 Dragon-wuxl 阅读(130) 评论(0) 推荐(0)

虚函数的本质就是指针类型转换实现的结果

摘要: 1 /* 虚函数 */ 2 3 #include 4 5 using namespace std; 6 7 class A 8 { 9 public: 10 A(char x):x(x) 11 { 12 13 } 14 15 vo... 阅读全文

posted @ 2015-06-10 09:19 Dragon-wuxl 阅读(94) 评论(0) 推荐(0)

2015年6月9日

虚函数的意义

摘要: 1 /* 虚函数的意义 */ 2 3 #include 4 #include 5 6 using namespace std; 7 8 9 class myinterface10 {11 public:12 virtual void server()13 {14 ... 阅读全文

posted @ 2015-06-09 23:31 Dragon-wuxl 阅读(143) 评论(0) 推荐(0)

父类与子类指针的问题

摘要: 1 /* 父类与子类指针的问题 */ 2 3 4 #include 5 6 using namespace std; 7 8 class ye 9 { 10 public: 11 ye() 12 { 13 this->p = new int... 阅读全文

posted @ 2015-06-09 19:08 Dragon-wuxl 阅读(145) 评论(0) 推荐(0)

静态联编与动态联编重载与覆盖的区别

摘要: 1 #include 2 3 using namespace std; 4 5 class A 6 { 7 public: 8 9 void print(int num)10 {11 cout << num << endl;12 }13 14 ... 阅读全文

posted @ 2015-06-09 15:50 Dragon-wuxl 阅读(258) 评论(0) 推荐(0)

多态

摘要: 1 /* 多态 */ 2 3 #include 4 #include 5 6 using namespace std; 7 8 void print() 9 {10 printf("tasklist & pause");11 }12 13 void run()14 {15 s... 阅读全文

posted @ 2015-06-09 15:42 Dragon-wuxl 阅读(95) 评论(0) 推荐(0)

Qt演示多继承以及虚基类

摘要: 1 #include "dialog.h" 2 #include 3 #include 4 5 6 7 //需要分别操作一个对象,不需要虚继承 8 //需要操作同一个,需要虚继承 9 //10 class DialogX //虚基类11 {12 protected:13 Di... 阅读全文

posted @ 2015-06-09 14:48 Dragon-wuxl 阅读(874) 评论(0) 推荐(0)

多继承以及虚基类

摘要: 1 /* 多继承以及虚基类 */ 2 #include 3 4 using namespace std; 5 6 7 // 只有多继承 才产生虚基类 8 9 class base // 虚基类10 {11 public:12 base()13 {14 cou... 阅读全文

posted @ 2015-06-09 14:45 Dragon-wuxl 阅读(115) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 10 ··· 16 下一页

导航