If the former is the core engineering classes, often need to do this, can be in the latter the constructor of the incoming core class instances of them, and then add a core classes in the latter's attributes and initialized in the constructor, so that you can call at any time in the latter the former members of the function
CodePudding user response:
I want to ask the question is what?CodePudding user response:
If such a mean?@ Data
Public class A {
Private bInstance B;
BInstance public A (B) {
Enclosing bInstance=bInstance;
}
Public void methodOfA () {
BInstance. MethodOfB ();
}
Static class B {
Public void methodOfB () {
System. The out. Println (" this is a method in a class B ");
}
}
}