Inheritance and Polymorphism

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Subclassing

A child class needs to identify which class it its parent class. This can be done by mentioning the parent class name in the definition of the child class.

Multiple Inheritance

A class is derived form more than one base class, all the features of the base classes are inherited into the derived class.

Inheritance

A mechanism that allows you to create a hierarchy of classes that share a set of properties and methods by deriving a class from another class.

Sub Class (Child Class)

Class that inherits the features of other classes. Also have their own features in addition to the inherited ones.

Super Class (Parent/ Base Class)

Class whose features are inherited by other classes.

Reusability

Concept where we can derive a new class from existing classes

Hybrid Inheritance

Consisting of multiple types of inheritance.

Subclassing (Properly use the attributes of the parent class)

Do not create a constructor for the subclass and use Getters and Setters instead

Single Inheritance

Enables a derived class to inherit properties from a single parent class, thus enabling code reusability and the addition of new features to existing code.

Multilevel Inheritance

Features of the base class and the derived class are further inherited into the new derived class. Representing a child and a grandfather.

Polymorphism

Having many forms. The same function name (but different signatures) being used for different types. The key difference is the data types and number of arguments used in function.

Subclassing (Properly use the attributes of the parent class)

Invoke the constructor of the parent class

Hierarchical Inheritance

More than one derived class are create from a single base. This program, we have a parent (base) class and two or more child (derived) classes.

Inheritance

One of the core concepts in object-oriented programming

Five Types of inheritance

Single Inheritance, Multiple Inheritance, Multilevel Inheritance, Hierarchical Inheritance & Hybrid Inheritance


Set pelajaran terkait

Spanish American War Created by Nathan And Landen

View Set

Matter and Energy in Ecosystems Vocabulary

View Set