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 |
What are some of the commonly used commands in sqlcommand?
What is interface inheritance in c#?
Can you pass value types by reference to a method?
i want the csharp questions&answeres
What is the difference between field and variable in c#?
What is string method in c#?
While debugging a C# application can you change the value of a variable?
Are multiple data types stored in System.Array?
What is difference between c and c sharp?
What is cosole application?
Can an interface extend a class c#?
What is the advantage of singleton class?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)