Here A is a class and B is another class right,
Let’s take a simple addition example
A(int x,int y)
{
b=new B(x+y);//let be a reference of class B
//this will call B’s constructor
}
B(int z)
{
this.z=z;//lets’s assume that z is a variable in B class
}
5
solved C pointers and objects as part of different classes [closed]