+ 1
What's the difference between Polymorphism and Overwriting ?
was ist der unterschied zwischen Polymorphi und Uberschreibung?
4 Réponses
+ 3
i dont know
+ 3
bzw keine ahnung
+ 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);
}
+ 1
sorry I think I was meant Overwriting
but Thank you for your answer :)