fork(1) download
  1. package main
  2.  
  3. import "fmt"
  4. import "math"
  5.  
  6. type geometry interface {
  7. area() float64
  8. perim() float64
  9. }
  10.  
  11. type rect struct {
  12. width, height float64
  13. }
  14.  
  15. func (r rect) area() float64 {
  16. return r.width * r.height
  17. }
  18.  
  19. func (r rect) perim() float64 {
  20. return 2*r.width + 2*r.height
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
# _/home/fIlUAw
./prog.go:3: imported and not used: "fmt"
./prog.go:4: imported and not used: "math"
stdout
Standard output is empty