Polymorphism

0
10

Polymorphism

The word ‘polymorphism’ literally means ‘the capacity to take on different forms’. When applied to object oriented programming language like Java, it describes a language’s ability to process objects of various types and classes through a single interface.

Example:

  1. public interface Small{}
  2. public class House{}
  3. public class Room extends House implements Small{}

Room class is considered to be polymorphic since this has multiple inheritance.

Virtual Methods

Every non-static method in JAVA is by default virtual method except final and private methods.JAVA does not use virtual keyword.In simple language any function that can be overriden via inheritance is virtual.

Facebook Comments
(Visited 13 times, 2 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here