Home > Back-end >  Java based
Java based

Time:10-25

How in the same package, in a class of another class to function called,
Such as a function of, public void a [] how to call this function in the b,

CodePudding user response:

Top, do me a favor?

CodePudding user response:

B inherits the method available

In the b method to create a one of a or b type a member variable or introduced into a class object in the method, also can call the method, the premise is a private method

CodePudding user response:

New out an instance of A in B A, then a.a (); Is implemented in B calls A method in A ()

CodePudding user response:

refer to three and A half cents reply: 3/f
new out an instance of A in B A, then a.a (); Is realized in the B calls A method in A ()
thanks brother who settled,