github.com/EngineerKamesh/gofullstack@v0.0.0-20180609171605-d41341d7d4ee/volume1/section3/simpleshape/simpleshape.go (about)

     1  // Package simpleshape is a simple interface for representing geometric shapes.
     2  package simpleshape
     3  
     4  // The Shape type represents a geometric shape.
     5  type Shape interface {
     6  	Area() float64
     7  }
     8  
     9  // Calculates the area of a shape. The area calculation is based on the type of shape s.
    10  func ShapeArea(s Shape) float64 {
    11  
    12  	return s.Area()
    13  
    14  }