网易云鬼手玩转PC逆向2022
2023-08-24 17:34 作者:bili_67158895267 | 我要投稿
但是在go里面继承的方法比较特殊,如下
type Person struct {
Name string
Age int}func (this *Person) GetName() {
fmt.Printf(this.Name)}type Student struct{
Person //这样Student类就可以继承Person类了
Score int //student类自己的属性}func main(){
stu := Student{}
stu.Name = "小饭" //继承父类的属性
stu.GetName() //继承父类的方法
return}