Skip to content

Instantly share code, notes, and snippets.

@luandevpro
Last active August 2, 2020 00:17
Show Gist options
  • Select an option

  • Save luandevpro/399b813b03bc3ade3ef0d76dd1bff866 to your computer and use it in GitHub Desktop.

Select an option

Save luandevpro/399b813b03bc3ade3ef0d76dd1bff866 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
type Address struct {
address string
phone int
}
type Student struct {
name string
email string
age int
address Address
}
func (t *Student) getName() {
t.name = "hehehe"
}
func main() {
student := &Student{
name: "tran",
email: "tran@gmail.com",
age: 25,
address: Address{address: "DN", phone: 84935},
}
student.getName()
fmt.Println(student.name)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment