What is polymorphism and its types in c#?



What is polymorphism and its types in c#?..

Answer / Surendra Singh Chauhan

Polymorphism is a principle that allows objects of different classes to be treated as if they were objects of the same class. In C#, there are two main types of polymorphism: compile-time polymorphism (also known as static polymorphism) and runtime polymorphism (also known as dynamic polymorphism).
1. Compile-Time Polymorphism: It occurs when methods with the same name but different implementations are defined in derived classes that override base class methods. This is achieved using function overriding and operator overloading.
2. Runtime Polymorphism: It occurs when an object of a derived class is treated as if it were an object of its base class, allowing us to call methods specific to the base class. This is achieved using method overloading, method dispatching, and interfaces.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Sharp Interview Questions

What are some of the commonly used commands in sqlcommand?

1 Answers  


What is interface inheritance in c#?

1 Answers  


Can you pass value types by reference to a method?

1 Answers  


i want the csharp questions&answeres

1 Answers   IBM, Siemens,


What is the difference between field and variable in c#?

1 Answers  


What is string method in c#?

1 Answers  


While debugging a C# application can you change the value of a variable?

1 Answers   Siebel,


Are multiple data types stored in System.Array?

1 Answers   Siebel,


What is difference between c and c sharp?

1 Answers  


What is cosole application?

1 Answers  


Can an interface extend a class c#?

1 Answers  


What is the advantage of singleton class?

1 Answers  


Categories