type geometry interface {
area() float64
}
type rect struct {
width, height float64
}
type circle struct {
radius float64
}
func (r rect) area() float64 {
return r.width * r.height
}
func (c circle) area() float64 {
return math.Pi * c.radius * c.radius
}
smalltalk 앞에서 OOP라고 깝치지 말자 - return 0;