上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 68 下一页
摘要: 1 //#include 2 //using namespace std; 3 // 4 // 5 //void main() 6 //{ 7 // cin.get(); 8 //} 9 10 #define _CRT_SECURE_NO_WARNINGS 11 #include 12 using namespace std; 13 14 class father... 阅读全文
posted @ 2018-03-19 20:41 喵小喵~ 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 1 #include "mainwindow.h" 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 //异构数据结构,每个数组元素都是基类指针 11 //异构链表,每一个结点都是基类的指针,指向了派生类 12 //基类指针基... 阅读全文
posted @ 2018-03-19 18:56 喵小喵~ 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 4 class Aobject 5 { 6 public: 7 //虚函数提供一个接口,自动选择子类的接口 8 //存储某个对象的地址,调用对应的方法 9 virtual void show() 10 { 11 cout show(); 29 ci... 阅读全文
posted @ 2018-03-19 18:14 喵小喵~ 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 4 class myclass 5 { 6 public: 7 int i = 10; 8 void show() 9 { 10 cout show(); 30 p2->show(); 31 cin.get(); 32 } 阅读全文
posted @ 2018-03-19 17:43 喵小喵~ 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 为什么要用虚基类 虚继承以及虚基类 1 #include <iostream> 2 using namespace std; 3 4 //虚基类 5 class A 6 { 7 public: 8 int a; 9 public: 10 A() 11 { 12 cout << "A()" << en 阅读全文
posted @ 2018-03-19 17:36 喵小喵~ 阅读(323) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 4 //构造的时候,从父类到子类构造 5 //子类构造先调用父类构造 6 class myclass 7 { 8 public: 9 int x; 10 int y; 11 12 public: 13 myclass(int a,int b):x(a),y(b) 14 ... 阅读全文
posted @ 2018-03-19 17:11 喵小喵~ 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include "coder.h" 3 #include "cppcoder.h" 4 #include "cocoscoder.h" 5 using namespace std; 6 7 void test() 8 { 9 cocoscoder man; 10 } 11 12 //继承,父类不依赖于子类,子类依赖于父类 13 //构造... 阅读全文
posted @ 2018-03-19 16:56 喵小喵~ 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 三种访问权限 public:可以被任意实体访问 protected:只允许子类及本类的成员函数访问 private:只允许本类的成员函数访问 三种继承特点 1、public继承不改变基类成员的访问权限 2、private继承使得基类所有成员在子类中的访问权限变为private (基类的private 阅读全文
posted @ 2018-03-19 16:36 喵小喵~ 阅读(2131) 评论(0) 推荐(1) 编辑
摘要: 类类型转换在实际开发中的用途 阅读全文
posted @ 2018-03-19 11:03 喵小喵~ 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 1 #include "mainwindow.h" 2 #include 3 #include > 4 5 //重载的三种形式,成员函数重载 6 //友元函数重载,可以使用私有变量以及保护变量 7 //一般函数重载都是公有变量 8 9 class buttons 10 { 11 QPushButton *p; 12 int n; 13 14 public... 阅读全文
posted @ 2018-03-19 00:10 喵小喵~ 阅读(155) 评论(0) 推荐(0) 编辑
上一页 1 ··· 23 24 25 26 27 28 29 30 31 ··· 68 下一页