Исходники и презентации
This commit is contained in:
15
lessons/generics_and_reflection/generic_method_set/main.go
Normal file
15
lessons/generics_and_reflection/generic_method_set/main.go
Normal file
@ -0,0 +1,15 @@
|
||||
package main
|
||||
|
||||
type S struct{}
|
||||
|
||||
func (S) Bar() {}
|
||||
|
||||
type C interface {
|
||||
S
|
||||
Foo()
|
||||
}
|
||||
|
||||
func foobar[T C](value T) {
|
||||
value.Foo()
|
||||
value.Bar() // compilation error
|
||||
}
|
||||
Reference in New Issue
Block a user