Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAndSet ¶
func GetAndSet(x MyInterface, i int)
Now any function which takes MyInterface as a parameter will accept a variable of type *MyType.
Types ¶
type MyInterface ¶
type MySubType ¶
type MySubType struct {
MyType // an anonymous field of type MyType
// contains filtered or unexported fields
}
This is not the same as a subclass in Java, but a form of delegation. When a method of an anonymous field is called, its receiver is the field, not the surrounding struct. In other words, methods on anonymous fields are not dynamically dispatched. When you want the equivalent of Java’s dynamic method lookup, use an interface.
Click to show internal directories.
Click to hide internal directories.