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?

답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 7월 30일

0 개 추천

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

댓글 수: 1

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

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Construct and Work with Object Arrays에 대해 자세히 알아보기

질문:

2012년 7월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by