上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页
摘要: 七、多态 1、多态的基本的概念 #include <iostream> #include <string> using namespace std; //多态 ​ //动态多态满足条件 //1.有继承关系 //2.子类重写父类的虚函数 //重写:函数返回值类型,函数名,参数列表完全相同 ​ //动态 阅读全文
posted @ 2021-08-23 21:41 yiwenzhang 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 1.man手册 man ls >>>>>man加命令 显示该命令的详细信息 ctrl + f >>>>>>向下翻页 ctrl + b >>>>>>向上翻页 man -key xxx >>>>>>>用关键字查询命令 man -f xxx 2.常用命令 sudo yum update 更新yum包管理工 阅读全文
posted @ 2021-08-20 17:59 yiwenzhang 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 六、继承 1、继承的基本语法 菜鸟写法: #include <iostream> #include <string> using namespace std; //普通实现页面 ​ //Java页面 class Java { public: void header() { cout << "首页、公 阅读全文
posted @ 2021-08-18 11:39 yiwenzhang 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 1.对象文件 g++ -c >将文件编译成对象文件 2.头文件 xxx.h 头文件存放:函数声明 <> :从系统路径下找头文件 "":从当前目录下查找头文件 将自定义的头文件也用<>引用时需要使用 g++ -I./include -c xxx.cpp将项目头文件设置到系统里 3.源文件 xxx.c 阅读全文
posted @ 2021-08-17 10:42 yiwenzhang 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 指针与地址 指针是程序数据在内存中的地址,而指针变量是用来保存这些地址的变量。 定义指针变量 C语言中,定义变量时,在变量名 前 写一个 * 星号,这个变量就变成了对应变量类型的指针变量。必要时要加( ) 来避免优先级的问题。 取地址 既然有了指针变量,那就得让他保存其它变量的地址,使用& 运算符取 阅读全文
posted @ 2021-08-17 10:22 yiwenzhang 阅读(728) 评论(0) 推荐(0) 编辑
摘要: 五、运算符重载 1、加号运算符重载 #include <iostream> #include <string> using namespace std; ​ //加号运算符重载 class Person { public: //1.成员函数重载+号 Person operator+(Person & 阅读全文
posted @ 2021-08-16 15:37 yiwenzhang 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 四、友元 1、全局函数做友元 #include <iostream> #include <string> using namespace std; ​ //建筑物 class Building { ​ //告诉编译器,GoodGay 全局函数是Building的好朋友,可以访问Building中的私 阅读全文
posted @ 2021-08-14 13:18 yiwenzhang 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 三、c++对象模型和this指针 1、成员变量和成员函数分开存储 #include <iostream> #include <string> using namespace std; ​ //成员变量和成员函数分开存储 //只有非静态成员变量,属于类的对象上 class Person { int m 阅读全文
posted @ 2021-08-13 18:53 yiwenzhang 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 二、对象的初始化和清理 1、构造函数和析构函数 #include <iostream> #include <string> using namespace std; ​ //对象初始化和清理 //1.构造函数 进行初始化操作 class Person { public: //1、构造函数: /* 1 阅读全文
posted @ 2021-08-13 11:27 yiwenzhang 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 类和对象 一、封装 #include <iostream> using namespace std; ​ const double PI = 3.14; //设计一个圆类,求圆的周长 //圆周长的公式:2*PI*半径 ​ //class 代表设计一个类 类后面紧跟着的就是类名 class Circl 阅读全文
posted @ 2021-08-12 17:35 yiwenzhang 阅读(104) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 12 下一页