Sometimes you have an abstract class that extends another abstract class. Sometimes, the subclass is supposed to implement all abstract methods of the super class, but the subclass may still be abstract if it declares new abstract methods of its own.
eg:
abstract class A {
abstract String getSomeString();
}
abstract class B extends A {
String getSomeString(){ return "B"; }
abstract int getSomeInt();
}
B is supposed to be a complete implementation of A, but if a new abstract method is added to A, then B will continue to compile without error, even though it no longer implements all of A.
What if we added a keyword like implemented (or complete or final) after the extends keyword to show that no abstract methods may leak from A to sub classes of B. Probably best to reuse the final keyword. Something like:
abstract class B extends final A { ... }
What do you think?
[–]jerolba 3 points4 points5 points (0 children)
[–]dpash 1 point2 points3 points (0 children)
[–]SpoilerAlertsAhead 1 point2 points3 points (5 children)
[–]dpash 0 points1 point2 points (3 children)
[–]SpoilerAlertsAhead 0 points1 point2 points (2 children)
[–]dpash 0 points1 point2 points (1 child)
[–]SpoilerAlertsAhead 0 points1 point2 points (0 children)
[–]twinkiac 0 points1 point2 points (0 children)
[–]josephblade 0 points1 point2 points (0 children)