Skip to content

Commit aad5a6d

Browse files
author
AnfangRobkit
committed
Adding Notes
1 parent 4f81240 commit aad5a6d

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

3.C++程序设计/week10(final)/计算数组的低3位之和.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ struct CMy_add
1111
void operator()(int val)
1212
{
1313
sum += (val & 7);
14+
//sum = sum + (val & 7);
15+
//注意按位与优先级低于加法!
1416
}
1517
};
1618

3.C++程序设计/week5/README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
例:以学生为基类,派生出研究生,大学生,中学生这些子类。
1515

16-
```c++
16+
```cpp
1717
class 派生类名: public 基类名
1818
{
1919
...
@@ -46,7 +46,7 @@ class 派生类名: public 基类名
4646

4747
例一:”圆“类包含”点“类,这是圆和点就是复合关系
4848

49-
```c++
49+
```cpp
5050
class Circle
5151
{
5252
double radius;
@@ -56,7 +56,7 @@ class Circle
5656

5757
例二:人狗关系!最好的写法是互相指向
5858

59-
```c++
59+
```cpp
6060
class Master;
6161

6262
class Dog
@@ -102,7 +102,7 @@ class Master
102102
103103
例:
104104
105-
```c++
105+
```cpp
106106
class Father
107107
{
108108
private:
@@ -148,7 +148,7 @@ int main()
148148

149149
### 初始化参数列表
150150

151-
```c++
151+
```cpp
152152
构造函数名(形参表):基类名(基类构造函数实参表)
153153
{
154154
...
@@ -180,7 +180,7 @@ int main()
180180

181181
**析构函数的调用顺序与构造函数的调用顺序相反**
182182

183-
```c++
183+
```cpp
184184
class Base
185185
{
186186
public:
@@ -225,7 +225,7 @@ int main()
225225

226226
## public继承的赋值兼容规则
227227

228-
```c++
228+
```cpp
229229
class base {};
230230
class derived : public base {};
231231
base b;
@@ -240,4 +240,8 @@ derived d;
240240
241241
## 直接基类和间接基类
242242
243-
在声明派生类时,只需要列出它的直接基类,派生类沿着类的层次自动向上继承它的间接基类
243+
在声明派生类时,只需要列出它的直接基类,派生类沿着类的层次自动向上继承它的间接基类
244+
245+
## Reference
246+
247+
https://www.coursera.org/learn/cpp-chengxu-sheji/supplement/JYzTL/ke-cheng-slides

0 commit comments

Comments
 (0)