Inheritance/Single: Difference between revisions

Content added Content deleted
(Added Rust)
Line 1,819: Line 1,819:
new subclass of Dog: Collie
new subclass of Dog: Collie
new subclass of Animal: Cat</pre>
new subclass of Animal: Cat</pre>

=={{header|Rust}}==
A type can't inherit properties from other types, but it can implmement any number of traits, which may themselves be subtraits of other traits.
<lang Rust>trait Animal {}
trait Cat: Animal {}
trait Dog: Animal {}
trait Lab: Dog {}
trait Collie: Dog {}</lang>


=={{header|Scala}}==
=={{header|Scala}}==