diff --git a/2.5.md b/2.5.md index 3527f2e9..e42d0046 100644 --- a/2.5.md +++ b/2.5.md @@ -28,7 +28,7 @@ 变成下图所表示的那样, 椭圆代表函数, 而这些函数并不从属于struct(或者以面向对象的术语来说,并不属于class),他们是单独存在于struct外围,而非在概念上属于某个struct的。 -![](images/2.5.rect_func_without_receive.png?raw=true) +![](images/2.5.rect_func_without_receiver.png?raw=true) 很显然,这样的实现并不优雅,而且从概念上来说一个"形状"的面积应该是"形状"的一个特性,应该是属于这个形状的,就像他的字段一样。 @@ -89,7 +89,7 @@ method的语法如下: 图示如下: -![](images/2.5.shapes_func_with_receive_cp.png?raw=true) +![](images/2.5.shapes_func_with_receiver_cp.png?raw=true) 在上例,method area() 分别属于Rectangle和Circle, 于是他们的 Receiver 就变成了Rectangle 和 Circle, 意思是,这个area()方法 是由 Rectangle/Circle 发出的。 diff --git a/images/2.5.shapes_func_with_receiver_cp.png b/images/2.5.shapes_func_with_receiver_cp.png new file mode 100644 index 00000000..2d26a01d Binary files /dev/null and b/images/2.5.shapes_func_with_receiver_cp.png differ