How do I get a member function in one class to know about another class

This is not my application, but it will illustrate my question. Suppose I have one class called TelephoneCall and another class called PBX. Both are defined as handle classes. Suppose I define a method (member function) in class PBX and want to pass an object of type TelephoneCall to it. For example, the method in class PBX could be called DialCall. I would want to pass a TelephoneCall object as an argument to the DialCall method of class PBX.
Is inheritance the only way I can have the PBX utilize data from the TelephoneCall object? Or is there another way by which a method of one object can "know" about another class?

Answers (1)

If you do not want the TelephoneCall object to inherit from PBX why not just give it its own DialCall method?

1 Comment

Thank you for replying. More detailed explanantion sought concerning how to get one object to know about the other.

Sign in to comment.

Asked:

on 30 Jul 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!