what is polymorphism with example?types of polymorphism?

Answer Posted / ramaraju

polymorphism means "same thing will exists with different
forms"

Ex :suppose we need to find volume of
circle,rectangle,triangle.ect in a sampe program.

genrally what we need to do is write the code volume for
cirle,rectangle,triangle in sepratly.
using polymorphism concept we simply write the volume code
with different parameter list ect

Ex:

class a {

volume(int a)//for rectangle
{
---
}
volume (int a,intb,intc)//for triangle
{

--
}

volume (string s)//for circle
{
--
}

}end of class A

polymorphisam are mainly two types
static polymorphisam(corresponding method will bind at the
time of compiling)
dynamic polymorphisam(corresponding method will bind at the
run time)

Is This Answer Correct ?    162 Yes 18 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is ststic with example

1597


What are the main uses of this keyword?

601


How do you read and print a string in java?

525


Explain covariant method overriding in java.

544


Can we overload destructor in java?

540






What is the difference between public, private, protected, and friend access?

572


Is null a string in java?

557


What is the difference between overriding & overloading?

566


placement papaers of spring computing technology

1024


Can classes declared using the abstract keyword cab be instantiated?

561


Are true and false keywords?

577


Is integer a class?

567


What do you mean by local class?

516


What does g mean in regex?

566


Is main a function?

516