L14 — Class Extension in Luau

ENTRY 14 // INHERITANCE AND METHOD OVERRIDING

Example: Animal





Example: Extending Animal into Cat





Output

...

How inheritance works

Animal is the base class-like table. Cat inherits its methods through a metatable, but defines its own myShow method. This overrides the inherited method when you call myShow on a Cat instance.