2021年8月8日
摘要:
1 //继承方式 2 //语法:class 子类 :继承方式 父类 3 //继承方式 三种: 4 //1.公共继承 5 //2.保护继承 6 //3.私有继承 7 8 /* 9 #include <iostream> 10 #include <string> 11 using namespace s
阅读全文
posted @ 2021-08-08 09:42
Bytezero!
阅读(83)
推荐(0)
摘要:
1 //继承方式 2 //语法:class 子类 :继承方式 父类 3 //继承方式 三种: 4 //1.公共继承 5 //2.保护继承 6 //3.私有继承 7 8 #include <iostream> 9 #include <string> 10 using namespace std; 11
阅读全文
posted @ 2021-08-08 09:07
Bytezero!
阅读(290)
推荐(0)
摘要:
1 //C++ 继承 2 //继承是面向对象三大特性之一 3 4 #include <iostream> 5 #include <string> 6 using namespace std; 7 8 //普通实现页面******************************************
阅读全文
posted @ 2021-08-08 08:37
Bytezero!
阅读(49)
推荐(0)
2021年8月7日
摘要:
1 //函数调用运算符重载 2 3 #include <iostream> 4 #include <string> 5 using namespace std; 6 7 //函数调用运算符重载 8 9 class MyPrint 10 { 11 public: 12 13 //重载函数调用运算符 1
阅读全文
posted @ 2021-08-07 17:45
Bytezero!
阅读(96)
推荐(0)
摘要:
1 //关系运算符重载 < = > != 2 #include <iostream> 3 #include <string> 4 using namespace std; 5 6 7 //重载关系运算符 8 class Person 9 { 10 public: 11 Person(string n
阅读全文
posted @ 2021-08-07 17:17
Bytezero!
阅读(168)
推荐(0)
摘要:
1 //赋值运算符重载 = 2 #include <iostream> 3 #include <string> 4 using namespace std; 5 6 //赋值运算符的重载 7 class Person 8 { 9 public: 10 11 Person(int age) 12 {
阅读全文
posted @ 2021-08-07 16:59
Bytezero!
阅读(146)
推荐(0)
摘要:
1 #include <iostream> 2 #include <string> 3 using namespace std; 4 5 //重载递增运算符 6 7 //自定义整形 8 class MyInteger 9 { 10 friend ostream& operator<<(ostream
阅读全文
posted @ 2021-08-07 16:28
Bytezero!
阅读(98)
推荐(0)
摘要:
1 #include <iostream> 2 #include <string> 3 using namespace std; 4 5 class Person 6 { 7 friend ostream& operator<<(ostream& cout, Person& p); 8 public
阅读全文
posted @ 2021-08-07 14:34
Bytezero!
阅读(89)
推荐(0)
摘要:
1 #include <iostream> 2 #include <string> 3 using namespace std; 4 5 //1.成员函数重载 +号 6 class Person 7 { 8 public: 9 10 //Person operator+(Person& p) 11
阅读全文
posted @ 2021-08-07 14:33
Bytezero!
阅读(140)
推荐(0)
摘要:
1 //友元 全局函数做友元 2 /* 3 #include <iostream> 4 #include <string> 5 using namespace std; 6 7 //建筑物类 8 class Building 9 { 10 11 //GoodGay全局函数 是 Building好朋友
阅读全文
posted @ 2021-08-07 11:32
Bytezero!
阅读(169)
推荐(0)