Skip to content

Commit e7a9ea8

Browse files
authored
Update implicit_cast_in_inheritance.md
1 parent 2e8dbc6 commit e7a9ea8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/ch07/inheritance/implicit_cast_in_inheritance.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ void f(Base*);
6666
int main() {
6767
Derived d;
6868
Derived* ptrd{&d};
69-
Base* b{d}; // 从 Derived* 类型隐式转换到 Base* 类型
70-
b = d; // 同上
71-
f(d); // 同上
69+
Base* b{ptrd}; // 从 Derived* 类型隐式转换到 Base* 类型
70+
b = ptrd; // 同上
71+
f(ptrd); // 同上
7272
}
7373
```
7474

0 commit comments

Comments
 (0)