Skip to content

Instantly share code, notes, and snippets.

@luandevpro
Created August 2, 2020 00:24
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/dadad34e40a3ed77240e0e4fe1adcd20 to your computer and use it in GitHub Desktop.
Save luandevpro/dadad34e40a3ed77240e0e4fe1adcd20 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
)
type Do interface {
getName() string
getAge() int
}
type Student struct{
name string
age int
}
func (t Student) getName() string {
return t.name
}
func (t Student) getAge() int {
return t.age
}
func main() {
student := Student{
name: "tran",
age: 25,
}
var do Do = student
do.getName()
fmt.Println(do.getName())
fmt.Println(do.getAge())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment