1.

What is Polymorphism and its types in OOPS?

Answer»

Polymorphism is one of the core concepts which is used in object-oriented programming. Polymorphism generally shows the relationships between parent class objects and child class objects.

Types of polymorphism in OOPs
  • Compile Time Polymorphism- It is also known as Static Binding and allows the programmer to implement various methods. Names can be the same but their parameters should be different.
  • Runtime Polymorphism- It is also known as DYNAMIC Binding and allows the programmer to CALL a single overridden method during the runtime of the PROGRAM.
10. What is Inheritance?

It is a technique in which one class acquires the property of ANOTHER class. With the help of inheritance, we can reuse the fields and methods of the existing class.

Inheritance has three type, are given below.

  • Single inheritance
  • Multiple inheritance
  • Multi level inheritance

But PHP supports only single inheritance, where only one class can be derived from single parent class. We can also use multiple inheritance by using interfaces.



Discussion

No Comment Found