ajikoe -
You can relate any two objects this way -- they don't have to have a parent/child relationship.
So, as long as class1 has a member variable of type class2, once an instance of class1 is created, it has the potential of knowing about a class2 instance. Once the class2 member has been pointed at an instance of a class2, then class 1 is able to use all the public methods of that class2 instance.
You can think of it this way -- imagine your mobile phone didn't have a keypad, but instead only allowed you to dial via it's phonebook. Since you bought the cheap phone, it only has one phonebook entry -- which is currently empty. Since your phonebook is empty you can't talk to anyone (but others can still call you via your number). Once you've added someone's number to your phonebook, you can now call them via their public interface (their number) and talk to them. If you have an argument and you're no longer friends, you erase the phonebook entry for them (set it to null), and you can now store someone else's phone number there.
Chip H.
____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first