Category: OOP Faqs
-
What is dynamic polymorphism?
Runtime polymorphism or dynamic polymorphism (dynamic binding) is a type of polymorphism which is resolved during runtime. An example of runtime polymorphism is method overriding.
-
What is static polymorphism?
Static polymorphism (static binding) is a kind of polymorphism that occurs at compile time. An example of compile-time polymorphism is method overloading.
-
What is polymorphism?
Polymorphism refers to the ability to exist in multiple forms. Multiple definitions can be given to a single interface. For example, if you have a class named Vehicle, it can have a method named speed but you cannot define it because different vehicles have different speed. This method will be defined in the subclasses with…
-
What is a subclass?
A class that inherits from another class is called the subclass. For example, the class Car is a subclass or a derived of Vehicle class.
-
What is a superclass?
A superclass or base class is a class that acts as a parent to some other class or classes. For example, the Vehicle class is a superclass of class Car.
-
What are the limitations of inheritance?
To know more about inheritance in Java and Python, read the below articles:
-
What is hierarchical inheritance?
Hierarchical inheritance refers to inheritance where one base class has more than one subclasses. For example, the vehicle class can have ‘car’, ‘bike’, etc as its subclasses.
-
What is hybrid inheritance?
Hybrid inheritance is a combination of multiple and multi-level inheritance.
-
What is the difference between multiple and multilevel inheritance?
Multiple Inheritance Multilevel Inheritance Multiple inheritance comes into picture when a class inherits more than one base class Multilevel inheritance means a class inherits from another class which itself is a subclass of some other base class Example: A class defining a child inherits from two base classes Mother and Father Example: A class describing…