+ 1

What's the difference between Polymorphism and Overwriting ?

was ist der unterschied zwischen Polymorphi und Uberschreibung?

19th Oct 2018, 2:30 PM
T4buk
T4buk - avatar
4 odpowiedzi
+ 3
i dont know
19th Oct 2018, 2:35 PM
dieserrapha
dieserrapha - avatar
+ 3
bzw keine ahnung
19th Oct 2018, 2:36 PM
dieserrapha
dieserrapha - avatar
+ 1
In OOP polymorphism is like class Animal { } class Cat extends Animal { } Animal c = new Cat() //this is polymorphism: Cat is considered as Animal Instead overloading is having more than one method with different arguments. ex. public void sayHello() { System.out.println("Hello"); } public void sayHello(String person) { System.out.println("Hi" + person) } public void sayHello(String person1, String person2) { System.out.println(person1+": Hi " + person2); }
19th Oct 2018, 3:03 PM
Daniele Bonomi
Daniele Bonomi - avatar
+ 1
sorry I think I was meant Overwriting but Thank you for your answer :)
20th Oct 2018, 8:40 PM
T4buk
T4buk - avatar