Ninja_5

command
v0.0.0-...-0ea0eec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Hands-on exercise #5

create a type SQUARE  --means create a struct
create a type CIRCLE
attach a method to each that calculates AREA and returns it
	circle area= π r 2
	square area = L * W
create a type SHAPE that defines an interface as anything that has the AREA method
create a func INFO which takes type shape and then prints the area
create a value of type square
create a value of type circle
use func info to print the area of square
use func info to print the area of circle

code: https://play.golang.org/p/NGGikHNvHv

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL