Skip to content

Instantly share code, notes, and snippets.

@ceaksan
Created March 9, 2018 07:58
Show Gist options
  • Save ceaksan/60c0e780a8e252c437b5fcb8ed617b45 to your computer and use it in GitHub Desktop.
Save ceaksan/60c0e780a8e252c437b5fcb8ed617b45 to your computer and use it in GitHub Desktop.
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