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 #include 4 5 using namespace std; 6 7 class A 8 { 9 int num;10 };11 12 class B : public A13 {14 double db;15 };16 17 c... 阅读全文

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

继承以及保护的案例

摘要: 1 /* 继承以及保护的案例 */ 2 3 #include 4 5 using namespace std; 6 7 const double PI = 3.141592657; 8 9 // 点10 class point11 {12 public:13 14 poin... 阅读全文

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

Qt演示单继承传递参数

摘要: 1 #include "mainwindow.h" 2 #include 3 #include 4 5 class ye 6 { 7 public: 8 ye(int a,int b):x(a),y(b) 9 {10 p= new MainWindow;11 ... 阅读全文

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

导航