Created
June 11, 2011 18:49
-
-
Save ghais/1020838 to your computer and use it in GitHub Desktop.
example.go
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
play.go:20: cannot use &b (type *Baz) as type Foo in function argument: | |
*Baz does not implement Foo (wrong type for FooBar method) | |
have FooBar(other *Baz) | |
want FooBar(other Foo) |
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 | |
type Foo interface { | |
FooBar(other Foo) | |
} | |
func Bar(f Foo) { | |
f.FooBar(f) | |
} | |
type Baz struct {} | |
func (b *Baz) FooBar(other *Baz) { | |
} | |
func main() { | |
var b Baz | |
Bar(&b) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment