Skip to content

Commit 8f6182e

Browse files
authored
Merge pull request huihut#57 from DiDongDongDi/master
修改可能的错误
2 parents 8cf0448 + 5c3c437 commit 8f6182e

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,9 @@ catch (bad_cast b) {
11311131
typeid、type_info 使用
11321132

11331133
```cpp
1134+
#include <iostream>
1135+
using namespace std;
1136+
11341137
class Flyable // 能飞的
11351138
{
11361139
public:
@@ -1143,6 +1146,7 @@ public:
11431146
void foraging() {...} // 觅食
11441147
virtual void takeoff() {...}
11451148
virtual void land() {...}
1149+
virtual ~Bird(){}
11461150
};
11471151
class Plane : public Flyable // 飞机
11481152
{
@@ -1164,7 +1168,7 @@ private:
11641168
...
11651169
};
11661170

1167-
class doSomething(Flyable *obj) // 做些事情
1171+
void doSomething(Flyable *obj) // 做些事情
11681172
{
11691173
obj->takeoff();
11701174

@@ -1177,7 +1181,15 @@ class doSomething(Flyable *obj) // 做些事情
11771181
}
11781182

11791183
obj->land();
1180-
};
1184+
}
1185+
1186+
int main(){
1187+
Bird *b = new Bird();
1188+
doSomething(b);
1189+
delete b;
1190+
b = nullptr;
1191+
return 0;
1192+
}
11811193
```
11821194
11831195
@@ -1472,14 +1484,14 @@ typedef struct {
14721484
* 问题的分解
14731485
* 问题规模的分解
14741486
* 折半查找(递归)
1475-
* 归并查找(递归)
1487+
* 归并排序(递归)
14761488
* 快速排序(递归)
14771489

14781490
#### 递归与迭代
14791491

14801492
* 迭代:反复利用变量旧值推出新值
14811493
* 折半查找(迭代)
1482-
* 归并查找(迭代)
1494+
* 归并排序(迭代)
14831495

14841496
#### 广义表
14851497

0 commit comments

Comments
 (0)