+ 1

What is polymorphism?

How is it used and on which context is it used?

10th Dec 2016, 3:24 PM
Anand Chourasiya
Anand Chourasiya - avatar
3 odpowiedzi
0
simple make multi functions with same name and different input values. like: bool compare(int a,int b){ return (a==b)?true:false; } bool compare(double a,double b){ return (Math.Round (a)==Math.Round (b))?true:false; } bool compare(string a,string b){ return (a.length==b.length)?true:false; }
10th Dec 2016, 3:40 PM
Ali Talebi
Ali Talebi - avatar
0
It means that you can use the interface as type and initialize it with an object of a class that implements that interface: List<String> foo = new Arraylist<String>() ; List<String> foo = new LinkedList<String>() ; Simple: the right side decides the actual object type..
10th Dec 2016, 7:14 PM
feye
- 1
This is my description: Polymorphism means that one method and many difeirent implementation. For example: creating sound is a method, and the following are implementaitons: pig - grunts, duck - quack, cow - moos.
11th Dec 2016, 12:24 AM
The PGDeveloper
The PGDeveloper - avatar