Discover Packages
github.com/q0phi80/learninggo
The-Go-Workshop
Chapter08
Package02
shape
package
Version:
v0.0.0-...-3662e1e
Opens a new window with list of versions in this module.
Published: May 21, 2020
License: GPL-3.0
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
func PrintShapeDetails(shapes ...Shape )
A function that accepts the Shape interface as a variadic parameter
The function will iterate over the Shape type and will execute each of its Name() and Area() methods
Create the Area() and Name() methods for the rectangle struct type
A Shape{} interface with two method sets called Area() float64 and Name() string
type Square struct {
Side float64
}
Create the Area() and Name() methods for the square struct type
Create struct types
Each of the structs will satisfy the Shape{} interface
Create the Area() and Name() methods for the triangle structure type
Source Files
¶
Click to show internal directories.
Click to hide internal directories.