day04- A starter in C++
1.c++的类中隐含了this指针

2.用const修饰成员函数,和位置没有关系

而且const修饰的是this指针所指向的内存空间(其中,this指针默认就是带有const的,只读),相当于

3.类的封装
.h文件用来声明类中的成员
和类同名的.cpp用来实现类中的函数
在调用的时候,只要把.h包含到需要用的地方就可以了
4.友元函数

友元函数可以修改类的私有属性,而且定义友元函数的位置与是否是private或者public无关
例如,

5.友元类


则可以通过B类中的友元函数修改A类中的成员,整个B类中的成员全部是A的友元
友元函数和友元类破坏了类的私有性(封装性)
6.运算符重载(运算符定义)

当自定义数据类型进行运算的时候,就需要运算符重载

7.运算符重载的语法


8.运算符重载的步骤


等效于,

9.相关知识点



10.以上是基本运算符重载的概念,还有二元运算符重载,等号重载等等.之后做练习题的时候再进行详细的学习,本次只了解一下运算符重载的概念和简单的运算符重载