Type my_int int
Func (n * myint) add myint (x) {
* n +=x
}
Func main () {
Var x my_int=123
X.a dd (100)
}
This way made his my_int int more function on the basis of the method of an add
What is the relationship between inheritance and this way please?
CodePudding user response:
This is a custom type, has nothing to do and inheritance, you can print typetype MyInt int
Func (n MyInt) test () {
FMT. Println (reflect the TypeOf (n.) Kind ())//or int, not structure
}
Func main () {
N1:=MyInt (5)
The (n1)
}