oop-examples/rust/Inheritance.md
2020-05-24 19:13:09 +02:00

322 B

Inheritance and Polymorphism

Rust does not allow extending classes. Instead the base class is stored as a field in the extending class. Polymorphism can then be achieved by passing the field instead of the whole object to a function. Although casting back to the advanced class or overriding functions is not possible.