Created
October 11, 2015 13:27
-
-
Save achilles42/0da5074d2af5e463feca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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