Last active
November 12, 2016 13:33
-
-
Save ferdiunal/4c2c4a0c573cc5501f0039b79041610a 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 familyInterface interface { | |
getFather() family | |
getMother() family | |
} | |
type family struct { | |
first_name string | |
last_name string | |
middle_name string | |
birth_date string | |
father *family | |
mother *family | |
} | |
func (f *family) getFather() family { | |
return *f.father | |
} | |
func (f *family) getMother() family { | |
return *f.mother | |
} | |
func imple(f familyInterface) { | |
fmt.Print(f.getMother()) | |
} | |
func main() { | |
fm := &family{ | |
first_name: "Ali", | |
middle_name: "KAAN", | |
last_name: "ÜNAL", | |
birth_date: "2016/01/14", | |
father: &family{ | |
first_name: "Ferdi", | |
last_name: "ÜNAL", | |
birth_date: "1991/08/30", | |
}, | |
mother: &family{ | |
first_name: "Tuba", | |
last_name: "ÜNAL", | |
birth_date: "1988/06/22", | |
}, | |
} | |
imple(fm) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment