You have an interface:
interface ExampleInterface {
method1;
method2;
method3;
}
Then an abstract class that implements SOME, not all of the methods:
abstract class AbstractClass{
method1 { // implementation details }
method2 { // implementation details }
}
Then concrete classes that extend the abstract class, as well as implementing the remaining method from the interface.
class SubclassOne extends AbstractClass {
method3 { // implementation detais }
}
class SubclassTwo extends AbstractClass {
method3 { // different implementation }
}
Is this allowed? Does the abstract class not have to implement ALL the methods of the interface?
Or can it just declare the method signature without implementation as below:
abstract class AbstractClass {
method1 { // implementation details }
method2 { // implementation details }
abstract method3; // no implementation
}
What would be the reasoning behind an abstract class not having to fully implement an interface, and not declare an abstract method? Does the abstract
in front of method3
now make it a different method from the one in the interface?