The correct OO way to do this is to use the
Bridge Design Pattern.<br><br>I will describe the design
pattern and then explain WHY this is the best OO way to
do this.<br><br>You create a class with a method
that accepts the two objects as parameters. Each class
should have get/set methods for each of the variables.
The bridge class would get the variables one by one
from object A and pass it to Object B.<br><br>This
sounds like a lot of work, but what this does is
"uncouple" Class A and Class B. Class A doesn't even have to
know about the existance of Class B and vice versa.
The "bridge" class is the object that
knows.<br><br>That way, if Class A changes, Class B doesn't have to
change. If class B goes away, class A doesn't have to
change. And the bridge only passes those pieces of
information that are needed to be passed. One could also have
Class A and Class B implement an interface which has
those methods describing the variables which need to be
passed.<br><br>While this is not the most efficient method, it is one
that helps in the maintaince, "reusablitiy" and
encapsulation of each class.<br><br>Hope this
helps.<br><br>Stephen McConnell<br>http://www.crosslogic.com