On Tue, Dec 2, 2008 at 3:27 PM, Tracy Harms <[EMAIL PROTECTED]> wrote:
> On this topic, I've been aware that my solution to the multiple
> inheritance task at Rosetta Code is weak. It occurs here:
>
> http://www.rosettacode.org/wiki/Multiple_inheritance#J
>
> The fact that I don't use coinsert suggests that I'm not handling this
> right. However, I want the creation-specific code for both parent
> classes to be executed when an object of type CameraPhone is created,
> and I think using coinsert in the manner you described would result in
> only one being effective. (I don't see that the situation here would
> be fixed using the "closure-based inheritance" I mentioned recently.)

coinsert only deals with inheritance, it does not deal with
the delegation of constructors.

Here's how I would implement CameraPhone, based on
your entry, except that a CameraPhone is a Camera and
a CameraPhone is a MobilePhone.

coclass 'CameraPhone'
coinsert 'Camera MobilePhone'

create=: verb define
   create_Camera_ y
   create_MobilePhone_ y
   NB. creation details specific to a camera phone go here
)

destroy=: verb define
   codestroy ''
)

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to