たとえば、サブクラスを使用してスーパークラスの実装を取得する方法を知りたかっただけです。
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
スーパークラスの実装を取得するためにそれをアップキャストしようとしましたが、役に立ちませんでした
((Animal)animal1).poo() // still returns the horse class's implementation of the method
animal1 オブジェクトを使用してスーパークラスの実装を取得するにはどうすればよいですか?