Skip to content

Instantly share code, notes, and snippets.

@luandevpro
Created August 1, 2020 14:31
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 luandevpro/eb3745db9cef8ca6ccdfb8e50b0cef97 to your computer and use it in GitHub Desktop.
Save luandevpro/eb3745db9cef8ca6ccdfb8e50b0cef97 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() string {
return t.name
}
func main() {
student := Student{
name: "tran",
email: "tran@gmail.com",
age: 25,
address: Address{address: "DN", phone: 84935},
}
fmt.Println(student.getName())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment