what is advantages of polymorphism [Resolved]

Posted by Yugandhar under Interview Questions on 9/1/2012 | Points: 10 | Views : 58218 | Status : [Member] | Replies : 6
what is advantages of polymorphism
how it can help in oops
plz provide information but not links




Responses

Posted by: Muhsinathk on: 9/5/2012 [Member] Bronze | Points: 50

Up
0
Down

Resolved
Polymorphism means the ability to take more than one form. An operation may exhibit different behaviors in different instances. The behavior depends on the data types used in the operation

Advantages of polymorphism:

- Same interface could be used for creating methods with different implementations
- Reduces the volume of work in terms of distinguishing and handling various objects
- Supports building extensible systems
- Complete implementation can be replaced by using same method signatures

Advantages of dynamic binding:

- Compiling time is much lower and allows faster development
- The current state of the program is better known to the runtime linker, so that the memory and its resources can easily be reordered
- The addresses symbols which may not be known at compile time, can be resolved by the runtime linker. This process is ideal for networked systems
- Common resources could well be shared instead of duplicating them in each time of execution.

Yugandhar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopesh9 on: 9/3/2012 [Member] Starter | Points: 25

Up
0
Down
Polymorphism is one of the features provided by OOP. We can say that polymorphism makes it possible to call different methods using one interface. We can also say that it means taking multiple advantages from one thing.

G. S.
.Net Developer

Yugandhar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ranjeet_8 on: 9/3/2012 [Member] [MVP] Gold | Points: 25

Up
0
Down
It is the ability to appear in different forms. In oops concept, it is the ability to process objects differently depending on their data types. Its the ability to redefine methods for derived classes.

There Are Two Types of Polymorphism
1.Run time Polymorphism :
.Run time Polymorphism also known as method overriding
.Method overriding means having two or more methods with the same name , same signature but with different implementation
2.Compile time Polymorphism :
.Compile time Polymorphism also known as method overloading
.Method overloading means having two or more methods with the same name but with different signatures

For more info plz read this article
http://www.dotnetfunda.com/articles/article1005-basic-concepts-of-oop-polymorphism.aspx



Yugandhar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Maheshvishnu on: 9/3/2012 [Member] Starter | Points: 25

Up
0
Down
Method overloading
Method overriding
method hiding

The above 3 features comes under Polymorphism

mahesh

Yugandhar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shanky11 on: 9/3/2012 [Member] Starter | Points: 25

Up
0
Down
because by defining same name we can perform diff calculation by pass diff argument
class abc
{
public int add(int a ,int b)
{
return a+b;

}
public int add()
{
return a- b;

}
class test
{
public static void main ()
{
abc a1=new abc();
int res=a.add(25,12);
int res1 = c1.add(48,12)
console.wrtline(res);.............. ans 37
console.wrtline(res1);.............. ans 36
}
}

Yugandhar, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 9/5/2012 [Member] Starter | Points: 25

Up
0
Down
Good Explanation Ms.Muhsinathk

Thanks & Regards
Hari

Yugandhar, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response