August 2019
Beginner to intermediate
798 pages
17h 2m
English
In this section, you will learn how to develop your own interfaces, which is a relatively easy process as long as you know what you want to develop.
The technique is going to be illustrated using the Go code of myInterface.go, which will be presented shortly. The interface that is going to be created will help you to work with geometric shapes of the plane.
The Go code of myInterface.go is next:
package myInterface
type Shape interface {
Area() float64
Perimeter() float64
}
The definition of the shape interface is truly straightforward as it requires that you implement just two functions, named Area() and Perimeter(), that both return a float64 value. The first function will be used to calculate the area of a ...
Read now
Unlock full access