Created
March 9, 2018 07:58
-
-
Save ceaksan/60c0e780a8e252c437b5fcb8ed617b45 to your computer and use it in GitHub Desktop.
This file contains 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 Person struct { | |
FirstName, LastName string | |
} | |
type Worker interface { | |
defineUser() string | |
} | |
type Personal struct { | |
Id int | |
CompanyName string | |
} | |
func (p *Person) defineUser() string { | |
return fmt.Sprintf("%s %s", p.FirstName, p.LastName) | |
} | |
func (pr *Personal) Company(c Worker) string { | |
return fmt.Sprintf("Dear \"%s\" (%d) welcome to %s", c.defineUser(), pr.Id, pr.CompanyName) | |
} | |
func main() { | |
ps := &Personal{23, "Google"} | |
u := &Person{"Matt", "Aimonetti"} | |
fmt.Println(ps.Company(u)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment