adspace
Answer Posted / 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 View All Answers