2
Reply

.NET/ASP.NET Interview Questions:-What is Polymorphism? How does VB.NET/C# achieve polymorphism?

    Polymorphism is the ability to react differently based on the information associated with the message .The concept of using operators or functions in different ways depending on what they operating on is called polymorphism.It is achieved in the form of function overloading.

    An example function overloading is an add() function which can take different signatures at runtime.Like function can be overloaded as add(int a,int b) or add(float a,float b) depending upon the type of parameters passed at runtime.

     Answers

    This is a nice and simple OOP interview question. As the name says POLY (Many) MORPHISM (Change). Polymorphism is the ability of the object to behave differently under different conditions. For instance a simple user object can behave as a admin user or as a simple user depending on conditions.

    There are two ways of doing polymorphism dynamic and static. Static polymorphism is achieved by using method overloading and dynamic polymorphism is achieved by using method overriding. Please note do confuse with overloading and overriding while answering this question. Many .NET developers make a nice versa statement leading to lot of confusion.


    Click her for more 40 fundamentals .NET interview question