Here, as I understand it, the three classes interact with each other based on the fourth (class B).

public abstract class A { public B bb; // constructor public A(B beb) { bb = beb; } } public class B { /*Класс с переменными и методами*/ } public class C extends A { //constructor public C(B beb){ super(beb); } } 

Below it is not clear when class C is invoked with reference to class B as a parameter.

 public class D{ public B bb; public C cc; public void init(){ cc = new C(bb); } 

And what exactly happens in the whole code?

PS the program starts with the init () method

    1 answer 1

    here:

     cc = new C(bb); 

    an instance of class C , with this a reference to instance B (bb) is passed as a parameter to the constructor.

    further constructor C :

     public C(B beb){ super(beb); } 

    takes an instance as an argument and calls the parent constructor, passing in B

    In the parent constructor

     public A(B beb) { bb = beb; } 

    beb added to bb variable


    The question is vague and does not look like a question at all. Therefore, the answer is in the same style.

    • And when a link to an instance is passed as a parameter, are all variables and methods passed? - YOLO STYLE
    • @YOLOSTYLE yes, yes ... but you can still only apply to the public. - Alexey Shimansky