1
Answer

Inheritance-Memory mgmt

Photo of amit_gupta14

amit_gupta14

15y
2.7k
1

Class A{

Public method1()

}

 

Class B:A {

Public method2()

}

 

B bb=new BB();

bb.method1();

bb.method2();

bb can call both methods.

Say bb address is 100

 

At 100: method1 will be there. This address will contain either address of method1 or copy of method2. I am not sure which one. Because of this only, bb will be able to refer method1 also of class A.

 

Plz confirm me.

Answers (1)