Instruction

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Heads up... You’re accessing parts of this content for free, with some sections shown as scrambled text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Demystifying Inheritance

Inheritance is used to model your app’s data if your objects have some properties in common but some groups of objects have additional properties and/or specific behaviors. Rather than duplicating common code across all instances, you create subclasses that inherit properties and methods from the parent class. Additionally, you can add properties and methods specific to each subclass.

JoniifOkmesc Doviqixz Latcethz Kiehqiyt Htrjurg alk Yelzuel
Xapaoy ecb uzvarv xwimxusagufaiz jmii

Describing Polymorphism

A subclass could also have methods that are relevant and useful for that specific classification. You can override a method in the parent class to do something different, such as using additional properties. In plain English, Polymorphism means “to exist in many forms.” It occurs when each subclass object invokes its own version of a method, giving it many forms. You don’t need to write branching code to specify the object’s behavior, each object knows exactly what to do.

See forum comments
Download course materials from Github
Previous: Introduction Next: Demo