Interview Question
Qus: What are the defining traits of an object-oriented language?
Answers (1)
a) Inheritance
b) Abstraction
c) Encapsulation
d) Polymorphism
Inheritance: The main class or the root class is called as a Base Class. Any class which is expected to have ALL properties of the base class along with its own is called a Derived class. The process of deriving such a class is Derived class.
Abstraction: Abstraction is creating models or classes of some broad concept. Abstraction can be achieved through Inheritance or even Composition.
Encapsulation: Encapsulation is a collection of functions of a class and object. The “Food” class is an encapsulated form. It is achieved by specifying which class can use which members (private, public, protected) of an object.
Polymorphism: Polymorphism means existing in different forms. Inheritance is an example of Polymorphism. A base class exists in different forms as derived classes. Operator overloading is an example of a Polymorphism in which an operator can be applied in different situations.