Inheritance/Single: Difference between revisions

Content added Content deleted
m (syntax highlighting fixup automation)
(Added Odin variant)
Line 1,491: Line 1,491:
(*functions go here...*)
(*functions go here...*)
end</syntaxhighlight>
end</syntaxhighlight>

=={{header|Odin}}==

<syntaxhighlight lang="odin">package main

Animal :: struct {
alive: bool
}

Dog :: struct {
using animal: Animal,
obedience_trained: bool
}

Cat :: struct {
using animal: Animal,
litterbox_trained: bool
}

Lab :: struct {
using dog: Dog,
color: string
}

Collie :: struct {
using dog: Dog,
catches_frisbee: bool
}

main :: proc() {
pet : Lab

pet.alive = true
pet.obedience_trained = true
pet.color = "yellow"
}</syntaxhighlight>


=={{header|Oforth}}==
=={{header|Oforth}}==