When looking at the following code, each of the methods in each of the classes is considered polymorphic.
class A {
void foo() {}
}
class B extends A {
void foo() {}
}
class C extends A {
void foo() {}
}
Is it still the case in the following snippet, where class A is abstract?
abstract class A {
void foo() {}
}
class B extends A {
void foo() {}
}
class C extends A {
void foo() {}
}
I am working on this with a study group for the java certification exam, and I thought that it would not be. Because you could still access foo() in A if you were to extend class D but not define foo(), and thereafter attempt to access it. In such a case it wouldn't be polymorphic because there would be no change to it.
abstract class A {
void foo() {}
}
class D extends A {
}