Skip to content

Commit

Permalink
Update 01-What-is-an-Object.md
Browse files Browse the repository at this point in the history
remove character /u10
  • Loading branch information
chilejiang1024 authored Jul 16, 2019
1 parent 7e013f6 commit 312dc55
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/book/01-What-is-an-Object.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void doSomething(Shape shape) {
```java
doSomething(circle);
```
当预期接收 **Shape** 的方法被传入了 **Circle**,会发生什么。由于 **Circle** 也是一种 **Shape**,所
当预期接收 **Shape** 的方法被传入了 **Circle**,会发生什么。由于 **Circle** 也是一种 **Shape**,所
`doSomething(circle)` 能正确地执行。也就是说,`doSomething()` 能接收任意发送给 **Shape** 的消息。这是完全安全和合乎逻辑的事情。

这种把子类当成其基类来处理的过程叫做“向上转型”(**upcasting**)。在面向对象的编程里,经常利用这种方法来给程序解耦。再看下面的 `doSomething()` 代码示例:
Expand Down

0 comments on commit 312dc55

Please sign in to comment.