Consider the following case
class A
{
X()
{
//some code
Y();
}
}
class B extends A
{
Y(){ //some code }
}
If I create an object of the class B, and i try to use function X as it is extended from A, is it possible that the function X can access the function Y of the calling object of class B.
you could but this must be met
Example:
abstract class A {
void X() {
Y();
}
abstract void Y();
}
class B extends A {
@Override
void Y() {
System.out.println("Hello from B class");
}
}
in that form every time class A calls Y, it will actually invoke an implememted method of the abstract method Y
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With