[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Defininng and using an object as a Swarm and a SwarmObject at the
From: |
Alex Lancaster |
Subject: |
Re: Defininng and using an object as a Swarm and a SwarmObject at the same time. |
Date: |
21 Mar 1999 23:07:58 -0700 |
>>>>> "JV" == Joseph E Villa <address@hidden> writes:
JV> It seems what you've proposed is multiple inheritance. There's
JV> certainly a lot of discussion in OO design about multiple
JV> inheritance, and some would have you believe it is inheritantly
JV> (*g*) problematic from a pure design perspective. (I tend to stay
JV> away from multile inheritance, but I suspect this is one of those
JV> religious fervor topics.)
JV> You may be able to achieve multiple inheritence by including the
JV> SwarmObject.h and Swarm.h files in your Population
JV> files. (Cruising through some of the root Swarm classes, I think I
JV> came across this.)
Unfortunately this won't work (we don't use multiple inheritance
anywhere in the Swarm kernel). Objective C (and therefore Swarm)
doesn't support multiple-inheritance directly (C++ does, but Java
doesn't). But there are several ways to achieve a similar effect.
You can use Objective C protocols (to construct classes that conform
to a given interface, but that doesn't necessarily allow you access to
the *implementation*, like true multiple inheritance does).
Here's an online reference from the NeXT Objective C manual (now
hosted on the Apple website):
http://developer.apple.com/techpubs/macosxserver/System/Documentation/Developer/YellowBox/TasksAndConcepts/ObjectiveC/moreobjc.htm#787
The other approach is to use forwarding to mimic multiple inheritance,
the NeXT book on Objective C discusses this approach in more detail:
http://developer.apple.com/techpubs/macosxserver/System/Documentation/Developer/YellowBox/TasksAndConcepts/ObjectiveC/runtime.htm#1005
The top level for this online Objective C book is at:
http://developer.apple.com/techpubs/macosxserver/ObjectiveC/index.html
-- Alex
--
Alex Lancaster | e-mail: address@hidden
Swarm Program | web: http://www.santafe.edu/~alex
Santa Fe Institute | tel: +1-(505) 984-8800
-------------------------------------------------------------------
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.