Polymorphism means having more than one form. Polymorphism means same operation may behave differently on different classes. Polymorphism is classified into compile time polymorphism or early binding or static binding and Runtime polymorphism or late binding or dynamic binding. | ||
1) Static/early Binding: | ||
The mechanism of linking function with an object during compile time is called as static or early binding. Ex: Method overloading and operator overloading. | ||
Method\function Overloading: Two or more functions having save name, but they are differ in thier function signature is called as Method\function overloading. Function signature means: They can differ in Number of parameters, sequence of parameter & data type of parameter. Method Overloading forms compile-time polymorphism.
=> Advantages of method Overloading in C#.Net / When to Use Method Overloading / Why To Use Method Overloading | ||
2) Dynamic/Late Binding: | ||
The mechanism of linking function with an object during run time is called as dynamic or late binding. Ex: Method overriding / virtual functions / abstract classes | ||
Method Overriding: Method overriding occures when child class delcares a method with same name & signature as parent class. Here parent class must declares the method with virtual or overridable keyword, and child class must uses override keyword. Please look example as below, |
OOPS Concepts, OOPS interview questions, C#.Net interview questions, .Net framework interview questions, Asp.Net interview questions, SQL server interview questions, WCF interview questions, WPF interview questions, Angular Js interview questions
Tuesday, September 10, 2013
What is Polymorphism ? What is Static and Dynamic Polymorphism in .Net ?
Subscribe to:
Post Comments (Atom)
Labels
.Net Framework interview questions and answers
Asp.Net
Asp.net mvc
Auto Responder
Binary Gap
C#
C# Concepts
C# For Loop exception
Codility
Codility Cyclic Rotation Solution C#
Codility FrogJmp Solution
Codility OddOccurrencesInArray Solution C#.Net
Codility TapeEquilibrium Solution C#
Common table expression
CSS
Delegates in C#.Net
Entity Framework
Error Code 1175
Fiddle
Group By
Guid Default / Empty / Null parameter
Handle exceptions in loop
identity specification false
Kendo UI Editor
line height
My SQL
null can not insert
OOP & C#.Net interview Questions
OOPS
Span value jquery
SQL server
stringbuilder
stringbuilder clear
top 2 in group by for each group
Visual Studio
WCF
WPF
Sir, when we override a method with different operations which method call first?
ReplyDeleteand what is the advantage of Overriding?
Hi,
DeleteFor advantage/when to use/ why to use overriding please check below link,
http://dotnetpeoples.blogspot.in/2016/03/when-to-use-method-overriding-method.html
http://dotnetpeoples.blogspot.in/2016/03/method-overriding-vs-method-hiding.html
"when we override a method with different operations which method call first?" Means ??
Hi User,
DeletePlease check below link, I have updated advantages of it,
https://dotnetpeoples.blogspot.in/2016/04/whenwhy-to-use-method-overloading.html
Regards,
Jatin