Исходники и презентации
This commit is contained in:
26
lessons/interfaces/different_interfaces/main.go
Normal file
26
lessons/interfaces/different_interfaces/main.go
Normal file
@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
type Stringer interface {
|
||||
String() string
|
||||
}
|
||||
|
||||
// Embeds all types whose underlying type is []byte
|
||||
type AnyByteSlice interface {
|
||||
~[]byte
|
||||
}
|
||||
|
||||
// Embeds type union
|
||||
type Unsigned interface {
|
||||
uint | uintptr | uint8 | uint16 | uint32 | uint64
|
||||
}
|
||||
|
||||
func main() {
|
||||
var stringer Stringer
|
||||
_ = stringer
|
||||
|
||||
var any AnyByteSlice
|
||||
_ = any
|
||||
|
||||
var unsigned Unsigned
|
||||
_ = unsigned
|
||||
}
|
||||
Reference in New Issue
Block a user