Introduction
This challenge is about interfaces in Golang. Interfaces are named collections of method signatures.
This challenge is about interfaces in Golang. Interfaces are named collections of method signatures.
The problem is to implement an interface in Go, we just need to implement all the methods in the interface. Here we implement geometry
on rect
s and circle
s.
measure
function to work on any geometry
.circle
and rect
structs as arguments to measure
.$ go run interfaces.go
{3 4}
12
14
{5}
78.53981633974483
31.41592653589793
## To learn more about Go's interfaces, check out this
## [great blog post](https://jordanorelli.tumblr.com/post/32665860244/how-to-use-interfaces-in-go).
This challenge is about implementing an interface in Go. We implemented the geometry
interface on rect
s and circle
s and used a generic measure
function to work on any geometry
.