freshers/Experienced Dotnet jobs

20/09/2011

Difference between Dynamic polymorphism and static polymorphism

In static polymorphism response to a function is decided at compile time. In Dynamic polymorphism response to a function is decided at run time. 1)Static polymorphism is achieved by method overloading where as run time polymorphism( or dynamic polymorphism) is achieved by method overriding. 2)static polymorphism uses the concept of compile time binding(or early binding) where as dynamic polymorphism uses the concept of runtime binding (or late binding). 3)Dynamic polymorphism is faster than static polymorphism. 4)To implement static polymorphism inheritance is not necessary where as to implement dynamic polymorphism inheritance is necessary. 5)Generally when a programmer want to extend existing feature in a software,method overloading(load + extra load(more lines of code)) is used,and a programmer uses method overriding when he wants to provide a different implementation for the sa

Explain polymorphism?

polymorphism poly+morphos=many forms poly means "many" morphos means "forms".polymorphism allows one interface to be used for many functions. In static polymorphism response to a function is decided at compile time. In Dynamic polymorphism response to a function is decided at run time. 1)Static polymorphism is achieved by method overloading where as run time polymorphism( or dynamic polymorphism) is achieved by method overriding. 2)static polymorphism uses the concept of compile time binding(or early binding) where as dynamic polymorphism uses the concept of runtime binding (or late binding). 3)Dynamic polymorphism is faster than static polymorphism. 4)To implement static polymorphism inheritance is not necessary where as to implement dynamic polymorphism inheritance is necessary. 5)Generally when a programmer want to extend existing feature in a software,method overloading(load + extra load(more lines of code)) is used,and a programmer uses method overriding when he wants to provide a different implementation for the same feature.

Define virtual keyword?

when a method or property in a parent class need to be overridden in the child class,it should be declared as virtual in parent class and can be overridden in child class using override keyword. Now we should discuss about static polymorphism and dynamic polymorphism :)