Skip to content

Instantly share code, notes, and snippets.

@achilles42
Created October 11, 2015 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achilles42/0da5074d2af5e463feca to your computer and use it in GitHub Desktop.
Save achilles42/0da5074d2af5e463feca to your computer and use it in GitHub Desktop.
package main
import "fmt"
type Rectangle struct {
length, width int
}
func (r *Rectangle) Area() int {
return r.length * r.width
}
func main() {
r1 := &Rectangle{4, 3}
fmt.Println("Rectangle is: ", r1)
fmt.Println("Rectangle area is: ", r1.Area())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment