mirror of
https://github.com/MADTeacher/go_basics.git
synced 2025-11-23 21:34:47 +02:00
20 lines
325 B
Go
20 lines
325 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
type shape struct {
|
|
name string
|
|
}
|
|
|
|
func (s *shape) getName() string {
|
|
return s.name
|
|
}
|
|
|
|
func main() {
|
|
var firstInterface interface{} = shape{name: "Cube"}
|
|
var secondInterface interface{} = "Oo"
|
|
|
|
fmt.Printf("%+v\n", firstInterface) // {name:Cube}
|
|
fmt.Printf("%+v\n", secondInterface) // Oo
|
|
}
|