Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type Shape interface {
- area() float64
- }
- type Rectangle struct{
- height float64
- width float64
- }
- type Circle struct{
- radius float64
- }
- func (r Rectangle) area() float64 {
- return r.height * r.width
- }
- func (c Circle) area() float64 {
- return math.Pi * math.Pow(c.radius, 2)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement