Skip to content

Instantly share code, notes, and snippets.

@mkock
Created October 2, 2021 20:37
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 mkock/e5a58eae1021c3a98ffafff77ac8a6cd to your computer and use it in GitHub Desktop.
Save mkock/e5a58eae1021c3a98ffafff77ac8a6cd to your computer and use it in GitHub Desktop.
// School is defined in package school
type School interface {
Name() string
Location() string
students() []string
}
// University is defined in package schools
type University struct {}
func (u University) Name() string { return "Copenhagen University" }
func (u University) Location() string { return "Copenhagen City Center" }
func (u University) students() []string { return []string{"George", "Ben", "Louise", "Calvin"} }
var _ school.School = University{} // Error!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment