Advertisement
thunderboltsid

Untitled

Nov 25th, 2016
464
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.30 KB | None | 0 0
  1. type Shape interface {
  2.     area() float64
  3. }
  4.  
  5. type Rectangle struct{
  6.     height float64
  7.     width float64
  8. }
  9.  
  10. type Circle struct{
  11.     radius float64
  12. }
  13.  
  14. func (r Rectangle) area() float64 {
  15.     return r.height * r.width
  16. }
  17.  
  18. func (c Circle) area() float64 {
  19.     return math.Pi * math.Pow(c.radius, 2)
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement