package main
import "fmt"
type Point struct {
x int
y int
}
func (p *Point) get() string {
return fmt.Sprintf("Point(%v, %v)", p.x, p.y)
}
func (p *Point) set(x, y int) {
p.x = x
p.y = y
}
func main() {
p1 := Point {}
fmt.Println(p1.get())
p1.set(2, 3)
fmt.Println(p1.get())
}
To embed this project on your website, copy the following code and paste it into your website's HTML: