Object serialization: Difference between revisions
Content added Content deleted
(→{{header|Tcl}}: Omit from PureBasic) |
(→{{header|Go}}: library path update) |
||
Line 577: | Line 577: | ||
import ( |
import ( |
||
⚫ | |||
"fmt" |
"fmt" |
||
⚫ | |||
"os" |
"os" |
||
) |
) |
||
Line 672: | Line 672: | ||
type Cat struct { |
type Cat struct { |
||
Animal |
Animal |
||
LitterBoxTrained bool |
LitterBoxTrained bool |
||
} |
} |
||
⚫ | |||
func (c *Cat) print() { |
func (c *Cat) print() { |
||
switch { |
switch { |
||
Line 685: | Line 685: | ||
fmt.Println(" cat, not litter box trained") |
fmt.Println(" cat, not litter box trained") |
||
} |
} |
||
} |
} |
||
⚫ | |||
type Lab struct { |
type Lab struct { |
||
Dog |
Dog |
||
Color string |
Color string |
||
} |
} |
||
func (l *Lab) print() { |
func (l *Lab) print() { |
||
Line 698: | Line 698: | ||
} else { |
} else { |
||
r = l.Color + " lab" |
r = l.Color + " lab" |
||
} |
} |
||
switch { |
switch { |
||
case !l.Alive: |
case !l.Alive: |
||
Line 707: | Line 707: | ||
fmt.Printf(" %s, not trained\n", r) |
fmt.Printf(" %s, not trained\n", r) |
||
} |
} |
||
} |
} |
||
type Collie struct { |
type Collie struct { |
||
Dog |
Dog |
||
CatchesFrisbee bool |
CatchesFrisbee bool |
||
} |
} |