Here's a basic interface for geometric shapes.
| 10 | |
| 11 | // Here's a basic interface for geometric shapes. |
| 12 | type geometry interface { |
| 13 | area() float64 |
| 14 | perim() float64 |
| 15 | } |
| 16 | |
| 17 | // For our example we'll implement this interface on |
| 18 | // `rect` and `circle` types. |