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

2015年6月9日

类的字节对齐

摘要: 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)

2015年6月8日

派生类访问基类静态函数

摘要: 1 #include 2 3 using namespace std; 4 5 class base 6 { 7 public: 8 int num; 9 static int data;10 void print()11 {12 cout nu... 阅读全文

posted @ 2015-06-08 22:21 Dragon-wuxl 阅读(270) 评论(0) 推荐(0)

基类的静态成员

摘要: 1 /* 基类的静态成员 */ 2 3 #include 4 5 using namespace std; 6 7 class base 8 { 9 public:10 static int num;11 12 base()13 {14 num+=1;... 阅读全文

posted @ 2015-06-08 22:00 Dragon-wuxl 阅读(389) 评论(0) 推荐(0)

继承构造析构顺序以及原理以及重名变量函数

摘要: 1 /* 继承的内存原理 */ 2 3 /* 继承 */ 4 5 #include 6 7 using namespace std; 8 9 10 class ye 11 { 12 public: 13 int a = 11; 14 int b; 15 ... 阅读全文

posted @ 2015-06-08 21:31 Dragon-wuxl 阅读(163) 评论(0) 推荐(0)

自定义类类型之间互相转换

摘要: 1 /* 自定义类类型之间互相转换 */ 2 3 #include 4 5 using namespace std; 6 7 // complex -> area 8 // area -> complex 9 10 class area11 {12 public:13 double ... 阅读全文

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

2015年6月7日

类型转换

摘要: 1 /* 类型转换 */ 2 3 /* 转换方式 */ 4 5 #include 6 using namespace std; 7 8 int main() 9 { 10 int a = 3/2;// 隐式转换 11 12 double b = (int)... 阅读全文

posted @ 2015-06-07 09:55 Dragon-wuxl 阅读(72) 评论(0) 推荐(0)

为什么需要重载重载的简单实现

摘要: 1 /* 运算符重载 */ 2 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 int main() 10 { 11 12 char *str1 = "abc"; 13 14 ... 阅读全文

posted @ 2015-06-07 09:04 Dragon-wuxl 阅读(190) 评论(0) 推荐(0)

2015年6月6日

友元类

摘要: 1 /* 友元类 */ 2 3 #include 4 5 using namespace std; 6 7 class myclass 8 { 9 public:10 myclass(int a,int b):x(a),y(b)11 {12 13 }14 15 ... 阅读全文

posted @ 2015-06-06 16:56 Dragon-wuxl 阅读(86) 评论(0) 推荐(0)

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

导航