2021年8月9日
摘要: 1 #include <iostream> 2 #include <string> 3 #include<fstream> 4 using namespace std; 5 6 class Person 7 { 8 public: 9 char m_Name[64]; //姓名 10 int m_A 阅读全文
posted @ 2021-08-09 15:20 Bytezero! 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 1 //文件操作 2 //文本文件 读 ,写文件 3 4 #include <iostream> 5 #include <string> 6 #include<fstream> 7 8 using namespace std; 9 10 11 //文本文件 写文件 12 void test01() 阅读全文
posted @ 2021-08-09 14:55 Bytezero! 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 1 //多态案例三 电脑组装 2 3 #include <iostream> 4 #include <string> 5 using namespace std; 6 7 //抽象不同零件类 8 //抽象CPU类 9 10 class CPU 11 { 12 public: 13 //抽象的计算函数 阅读全文
posted @ 2021-08-09 11:32 Bytezero! 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 1 //虚析构和纯虚析构 2 3 #include <iostream> 4 #include <string> 5 using namespace std; 6 7 class Animal 8 { 9 public: 10 11 Animal() 12 { 13 cout << "Animal构 阅读全文
posted @ 2021-08-09 10:14 Bytezero! 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 1 //多态案例 制作饮品 2 //描述:煮水 冲泡 倒入杯中 加入辅料 3 4 #include <iostream> 5 #include <string> 6 using namespace std; 7 8 class AbstractDriking 9 { 10 public: 11 12 阅读全文
posted @ 2021-08-09 09:33 Bytezero! 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 1 //纯虚函数和抽象类 2 // 语法 virtual 返回值类型 函数名 (参数列表)=0 3 //当类中有了纯虚函数 这个类也称为抽象类 4 5 6 #include <iostream> 7 #include <string> 8 using namespace std; 9 10 clas 阅读全文
posted @ 2021-08-09 08:43 Bytezero! 阅读(103) 评论(0) 推荐(0) 编辑