fix error and modify corresponding sentences
This commit is contained in:
4
2.5.md
4
2.5.md
@@ -28,7 +28,7 @@
|
||||
|
||||
变成下图所表示的那样, 椭圆代表函数, 而这些函数并不从属于struct(或者以面向对象的术语来说,并不属于class),他们是单独存在于struct外围,而非在概念上属于某个struct的。
|
||||
|
||||

|
||||

|
||||
|
||||
很显然,这样的实现并不优雅,而且从概念上来说一个"形状"的面积应该是"形状"的一个特性,应该是属于这个形状的,就像他的字段一样。
|
||||
|
||||
@@ -89,7 +89,7 @@ method的语法如下:
|
||||
|
||||
图示如下:
|
||||
|
||||

|
||||

|
||||
|
||||
在上例,method area() 分别属于Rectangle和Circle, 于是他们的 Receiver 就变成了Rectangle 和 Circle, 意思是,这个area()方法 是由 Rectangle/Circle 发出的。
|
||||
|
||||
|
||||
BIN
images/2.5.shapes_func_with_receiver_cp.png
Normal file
BIN
images/2.5.shapes_func_with_receiver_cp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Reference in New Issue
Block a user