command
Version:
v0.0.0-...-4056b1e
Opens a new window with list of versions in this module.
Published: Jun 15, 2023
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
方法的接收者只能是结构类型 不能是接口
所以绑定在Shape类型上的Area方法,Rectangle如果调用,传入的参数在方法内部还是会当成Shape来处理,而不是Rectangle类
在Go做面向对象时应谨慎,它是has a 而不是 is a,父类对象没法调用子类对象上的方法
Source Files
¶
Click to show internal directories.
Click to hide internal directories.