上一页 1 2 3 4 5 6 7 8 ··· 10 下一页
摘要: #include <iostream> #include <string> #include <fstream> using namespace std; /* 模式标志 描述 ios::app 追加模式。所有写入都追加到文件末尾。 ios::ate 文件打开后定位到文件末尾。 ios::in 打开 阅读全文
posted @ 2021-01-15 12:11 y0um 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 基本概念 #include <iostream> #include <string> using namespace std; //抽象类,无法实例化对象。 class Animal { public: //3.通过加virtual关键字使其变虚函数。 virtual void talk() { c 阅读全文
posted @ 2021-01-14 11:43 y0um 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 基本语法 #include <iostream> #include <string> using namespace std; //语法:子类类名:public 父类类名 class Animal { public: Animal() ; void walk(string args) { cout 阅读全文
posted @ 2021-01-13 14:15 y0um 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 全局函数做友元 #if 0 #include <iostream> #include <string> using namespace std; //用friend关键字访问类中private的函数方法。 class Building { //2.在此用friend关键字声明! friend voi 阅读全文
posted @ 2021-01-13 10:41 y0um 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 类对象作为类成员 #include <iostream> #include <string> using namespace std; //c++类中的成员可以是另一个类的对象,称为对象成员。 class A { public: A() { cout << "A side \n"; }; ~A() 阅读全文
posted @ 2021-01-12 20:51 y0um 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 构造函数和析构函数 #include <iostream> #include <string> using namespace std; //创建一个类,C++编译器会给类添加至少三个函数 //默认构造函数;析构函数;拷贝构造函数,当自己创建这三个函数时就会抵消掉默认创建的函数了。 /* 构造函数: 阅读全文
posted @ 2021-01-10 17:31 y0um 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 类定义 #include <iostream> #include <string> using namespace std; #define PI 3.141592657 class Circle { //访问权限 //公共权限 public: //属性 int half_r; //行为 doubl 阅读全文
posted @ 2021-01-10 11:41 y0um 阅读(89) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> using namespace std; //.引用的本质在C++内部实现的是一个指针常量,引用必须初始化;引用初始化后不能被改变(不能在引用别的东西);引用和原名使用同一内存空间,修改都是一起修改。 int main() { //引用:给变量起别名 //语法 阅读全文
posted @ 2021-01-09 14:11 y0um 阅读(57) 评论(0) 推荐(0) 编辑
摘要: 内存分区 来源:https://blog.csdn.net/qq_33515733/article/details/107168302 图来源:https://blog.csdn.net/chenyijun/article/details/81938287 1、代码区 程序C/C++代码存放区,特点 阅读全文
posted @ 2021-01-08 11:56 y0um 阅读(191) 评论(0) 推荐(0) 编辑
摘要: /*C/C++ 数组允许定义可存储相同类型数据项的变量,但是结构是 C++ 中另一种用户自定义的可用的数据类型,它允许您存储不同类型的数据项。*/ #include <iostream> #include <string> using namespace std; //1.定义结构体 struct 阅读全文
posted @ 2021-01-06 10:44 y0um 阅读(79) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 10 下一页

新人优惠服务器