Dispatch vs Libraries

Mark Wieder mwieder at ahsoftware.net
Sun Nov 27 22:28:38 EST 2011


Sunday, November 27, 2011, 12:17:11 PM, you wrote:

> How does that pave the way for Multiple inheritance?  I was thinking as
> Jacque thought that this was the same as using any variable.

 I'm normally quite allergic to multiple inheritance, and so if I find
 myself in a situation where I need it I refactor things so that it's
 not necessary. That being the case, the following is probably a Bad
 Example, and should be a Gedankenexperiment only.

Given an employee class and a manager class in a company, a manager is
responsible for employees who may themselves be managers. Let's say,
for the sake of the example (or as in LC) that you can't have
subclasses of subclasses - you can have behavior objects but you can't
have behavior parents of behavior objects. Otherwise you'd just have
the manager class as a subclass of the employee class:

ManagerClass -- EmployeeClass -- object instance

What you'd need instead is multiple inheritance, where the object
instance gets two behavior buttons, a ManagerClass button and an
EmployeeClass button:

ManagerClass    EmployeeClass
      |             |
      |             |
      object instance

...so you'd have something like

dispatch tEmployeeID to Parent["GetReview"]
put the result into tReviewText
dispatch tEmployeeID to Parent["GetTeamMembers"]
put the result into tReviewText

where Parent["GetReview"] would probably contain the long id of the
EmployeeClass button and Parent["GetTeamMembers"] would contain the
long id of the ManagerClass button.

-Mark Wieder
 mwieder at ahsoftware.net

More information about the use-livecode mailing list