首页
关于作者
登录
菜单
首页
关于作者
Raymond's Blog
睿蒙博客
归档
2023 年 07 月
Linux的目录结构
2023-07-22
Linux
Linux文件组织方式 Linux的目录结构是一个树形结构。 众所周知,Windows可以拥有多个盘符(多棵树),文件的组织方式类似下方: 但是Linux中
计算机基础
2023-07-16
Linux
《鸟哥Linux私房菜》笔记
2022 年 12 月
文件的读写(IO流)
2022-12-18
C++
在C++中如果想要读写文件,需要引入一个库fstream,代表的是file stream,文件流的意思: #include <fstream> 接下来定义一个简单的写文件的函数: void write_file() { ofstream ofs; // ofstream代表的是out fil
处理异常
2022-12-18
C++
有时候我们需要手动处理一些能预料到的错误,来保证程序不会崩溃: void main() { try { string s = "bye"; cout << s.at(4); //cout << s[4]; } catch (ou
类的多态(Polymorphism)
2022-12-18
C++
多态的概念: 首先,我们先来看一个静态的多态的例子: class Point { public: int x; int y; Point() : x(0), y(0) {} Point(int _x, int _y) : x(_x), y(_y) {} &nb
类中的运算符重载
2022-12-18
C++
普通运算符重载: 通过运算符重载,可以定义对象执行相应运算符之后的行为,比如定义两个对象相加的行为: class Person { public: int age; Person() : age(18) {} Person operator+(const Person&
类的继承(Inheritance)
2022-12-17
C++
类的继承: 通过继承来减少代码量与提高复用性,一个基本例子: class Father { public: int age; string name; Father(): age(30),name("Father") {} } class Son: public
类的友元(friend)
2022-12-17
C++
这个东西不太重要,有个印象就行。 首先需要明确的是,在类中声明成员或方法的时候,如果没写访问权限,那就默认是private的: class Student { int age; // private的成员 public: int id; // public的成员 } 使用friend
类中的静态变量与静态方法
2022-12-17
C++
静态变量,指的是一个类中被static修饰的变量,这个变量可以被类中的方法、对象、类名直接修改或访问: class Student { public: char color; static int n_eyes; Student() : color('b') {} };
类中的this指针
2022-12-17
C++
在构造函数中,如果传进来的形参名字和成员名字一样,需要用this指针区分,否则无法赋值: class Student { public: int id; Student(int id) { this->id = id; // 如果直接写成id = id,那么
上一页
10 / 11
下一页