Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualSky Warden

Posted 28 May 2013 - 08:16 PM

I often meet a condition in programming where I have a class which takes an instance of another class and makes use of some functions in that imported class, while that class also needs some functions in the first class.

 

Like class A has function x() and y(), and class B has function i() and j(). Class A needs to use function i() in class B, and function j() in class B needs to use function y() in class A.

 

How can I reduce this to minimum? Is there any better way to do this? For some reasons, function y is only available in class A.

 

Oh, almost forgot this question. How can I do this the right way?

 

Thank you everyone.


#1Sky Warden

Posted 28 May 2013 - 08:06 PM

I often meet a condition in programming where I have a class which takes an instance of another class and makes use of some functions in that imported class, while that class also needs some functions in the first class.

 

Like class A has function x() and y(), and class B has function i() and j(). Class A needs to use function i() in class B, and function j() in class B needs to use function y() in class A.

 

How can I reduce this to minimum? Is there any better way to do this? For some reasons, function y is only available in class A.

 

Thank you everyone.


PARTNERS