Object-oriented programming (OOPs) Question:

Download Job Interview Questions and Answers PDF

What is Polymorphism?

OOP Interview Question
OOP Interview Question

Answer:

In OPP’S, polymorphism(Greek meaning “having multiple forms”) is the ablity of being able to assign a different meaning or usage to something in different contexts - specifically, to allow an entity such as a a function, or an object to have more than one forms.

In C# :
Parent classes may define and implement “virtual” methods(Which is done using the “virtual” keyword), and derived classes can override them(using the “override” keyword), which means they provide their own definition and implementation.At run-time, when user’s code calls the method, the CLR looks up the run-time type of the object, and invokes that override of the virtual method. Thus in your source code when a method of the base class is called it executes the overriden method.

Download OOP Interview Questions And Answers PDF

Previous QuestionNext Question
What Are Attributes in DotNet?Can we declare private class in a Namespace?