Deviopath › Go

Shape Area

Medium · Interfaces

An interface is a set of methods. Shape has Area() float64. Circle and Square should implement it. TotalArea ranges over []Shape and sums Area().

Use math.Pi for the circle. RunAreas(circleR, squareS) is already written.

Next: fmt.Stringer