github.com/EngineerKamesh/gofullstack@v0.0.0-20180609171605-d41341d7d4ee/volume1/section3/simpleshape/rectangle.go (about) 1 package simpleshape 2 3 type Rectangle struct { 4 width float64 5 height float64 6 } 7 8 func NewRectangle(w float64, h float64) *Rectangle { 9 return &Rectangle{width: w, height: h} 10 11 } 12 13 func (r *Rectangle) Area() float64 { 14 return r.width * r.height 15 }