A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
32
Task/Inheritance-Single/Go/inheritance-single.go
Normal file
32
Task/Inheritance-Single/Go/inheritance-single.go
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package main
|
||||
|
||||
type animal struct {
|
||||
alive bool
|
||||
}
|
||||
|
||||
type dog struct {
|
||||
animal
|
||||
obedienceTrained bool
|
||||
}
|
||||
|
||||
type cat struct {
|
||||
animal
|
||||
litterBoxTrained bool
|
||||
}
|
||||
|
||||
type lab struct {
|
||||
dog
|
||||
color string
|
||||
}
|
||||
|
||||
type collie struct {
|
||||
dog
|
||||
catchesFrisbee bool
|
||||
}
|
||||
|
||||
func main() {
|
||||
var pet lab
|
||||
pet.alive = true
|
||||
pet.obedienceTrained = false
|
||||
pet.color = "yellow"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue