I’m curious as to why abstract methods MUST be overridden by the first concrete implementing class, and not one further down the hierarchy change.
I’m not suggesting I want to do this, but I’m curious as to why it has to be the first class
Consider this example
abstract class Upper
{
abstract void doSomething();
}
class Middle extends Upper
{
void doSomething()
{
// I'm forced to be implemented here
}
}
abstract class Lower extends Middle
{
}
class Bottom extends Lower
{
void doSomething()
{
// I'm valid, but I'm too far down the hierarchy
}
}
By definition a normal class must implement all abstract methods. If you would declare Middle abstract, then you would not have to implement the methods in Middle.
A normal class can be instantiated, whereas a abstract class cannot. Think about what would happen if you try to call the methods that are not implemented in the class.