golang golang interface code example
Example 1: golang interface
type Shape interface {
area() float64
perimeter() float64
}
Example 2: interfaces in golang
The interface is a collection of methods as well as it is a custom type.
type Shape interface {
area() float64
perimeter() float64
}
The interface is a collection of methods as well as it is a custom type.