keep码
度过大难,将有大成。 继续努力,终成大器。
posts - 23,comments - 0,views - 6894
11 2021 档案
C++ STL初识
摘要:#include<iostream> #include<string> #include<vector> #include<algorithm>//标准算法头文件 using namespace std; //vector容器存放内置数据类型 void myPrint(int val) { cout 阅读全文
posted @ 2021-11-25 21:25 keep码 阅读(22) 评论(0) 推荐(0) 编辑
C++ 函数模板 排序算法
摘要:#include<iostream> #include<string> using namespace std; //实现通用 对数组进行排序的函数 //规则 从大到小 //算法 选择 //测试 char 数组、int数组 //交换函数模板 template<class T> void mySwap 阅读全文
posted @ 2021-11-22 16:15 keep码 阅读(132) 评论(0) 推荐(0) 编辑
C++ 多态案例
摘要:#include <iostream> using namespace std; #include <string> //多态案例 电脑组装 //抽象不同零件类 //抽象CPU类 class CPU { public: //抽象的计算函数 virtual void calculate() = 0; 阅读全文
posted @ 2021-11-20 17:52 keep码 阅读(65) 评论(0) 推荐(0) 编辑
C++ 动态多态
摘要:多态 #include <iostream> using namespace std; #include <string> //多态 //动物类 class Animal { public: //虚函数 virtual void speak() { cout << "动物在说话" << endl; 阅读全文
posted @ 2021-11-19 16:23 keep码 阅读(69) 评论(0) 推荐(0) 编辑
C++ 继承方式 继承同名成员处理 继承中的同名静态成员处理方式 多继承语法(认多个爹) 菱形继承
摘要:#include <iostream> using namespace std; #include <string> //继承方式 //公共继承 class Basel { public: int m_A; protected: int m_B; private: int m_C; }; class 阅读全文
posted @ 2021-11-18 16:48 keep码 阅读(96) 评论(0) 推荐(0) 编辑
c++ this指针概念
摘要:#include <iostream> using namespace std; #include <string> class Person { public: Person(int age) { //1、当形参和成员变量同名时,可用this指针来区分 this->age = age; } Per 阅读全文
posted @ 2021-11-15 22:11 keep码 阅读(26) 评论(0) 推荐(0) 编辑
c++ 静态成员
摘要:静态成员变量 #include <iostream> using namespace std; #include <string> class Person { public: static int m_A;//静态成员变量 //静态成员变量特点: //1 在编译阶段分配内存 //2 类内声明,类外 阅读全文
posted @ 2021-11-15 11:58 keep码 阅读(29) 评论(0) 推荐(0) 编辑
C++ 类对象作为类成员
摘要:#include <iostream> using namespace std; #include <string> class Phone { public: Phone(string name) { m_PhoneName = name; cout << "Phone构造" << endl; } 阅读全文
posted @ 2021-11-14 23:18 keep码 阅读(108) 评论(0) 推荐(0) 编辑
(C++核心编程 )初始化列表
摘要:#include <iostream> using namespace std; #include <string> class Person { public: //传统方式初始化 //Person(int a, int b, int c){ //m_A = a; //m_B = b; //m_C 阅读全文
posted @ 2021-11-14 22:34 keep码 阅读(33) 评论(0) 推荐(0) 编辑
(C++核心编程 )点和圆的关系
摘要:设计一个圆形类(Circle),和一个点类(Point),计算点和圆的关系。 未分文件书写版: #include <iostream> using namespace std; #include <string> //点类 class Point { public: //设置X坐标 void set 阅读全文
posted @ 2021-11-11 21:57 keep码 阅读(476) 评论(0) 推荐(0) 编辑
(C++核心编程)设计立方体类
摘要:设计立方体类(Cube) 求出立方体的面积和体积 分别用全局函数和成员函数判断两个立方体是否相等。 1 #include<iostream> 2 using namespace std; 3 #include<string> 4 class Cube 5 { 6 public: 7 8 //设置长 阅读全文
posted @ 2021-11-10 22:18 keep码 阅读(305) 评论(0) 推荐(0) 编辑

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

点击右上角即可分享
微信分享提示