i just wanted to know how to get the implementation of a superclass using a subclass, for example.
class Animal {
void poo() {
System.out.println("general poo");
}
}
class Horse extends Animal{
void poo() {
System.out.println("horse poo");
}
}
Animal animal1 = new Horse();
// using this I get the implementation of the Horse class's methods
animal1.poo(); //should return horse poo
tried to upcast it to get the super class implementation but to no avail
((Animal)animal1).poo() // still returns the horse class's implementation of the method
How do I get the superclass implementation using the animal1 object?