multiple inheritance usage

  • Follow


Hi all.
I have designed some class hiecracy:
shape -> shape3d -> ball
                          -> cylinder
                          -> parallelogram
                          -> randshape
Also I have a material class. And now I want to create the class which describe fragment properties (from HE shell). There is no problem to inherit material class, but I can not understand how to inherit ball, cyl, para & randshape classes, because I need to inherit only one class in different instances of fragment class. Now I save variations of shape3d classes in fragment class as property. Is there any way to do it without creating a property?
0
Reply m4 12/13/2010 2:55:32 PM

Guys, the question remains valid. Can I do something not clearly explained?
0
Reply m4 12/16/2010 12:12:05 PM


"m4 Chrennikov" <abrek77@gmail.com> wrote in message <ie5c54$5eb$1@fred.mathworks.com>...
> Hi all.
> I have designed some class hiecracy:
> shape -> shape3d -> ball
>                           -> cylinder
>                           -> parallelogram
>                           -> randshape
> Also I have a material class. And now I want to create the class which describe fragment properties (from HE shell). There is no problem to inherit material class, but I can not understand how to inherit ball, cyl, para & randshape classes, because I need to inherit only one class in different instances of fragment class. Now I save variations of shape3d classes in fragment class as property. Is there any way to do it without creating a property?

It's not clear to me what you want to do. 

classdef  myclass < material & randshape & ....

mc1 = myclass;
mc2 = myclass;

AFAIK there it is not possible to let mc1 inherit ball and mc2 inherit cylinder. However, I guess you can make new classes on the fly. I wouldn't. 

Why not use composition?

/ per
0
Reply per 12/16/2010 2:38:06 PM

"per isakson" wrote in message <ied88e$a97$1@fred.mathworks.com>...

> AFAIK there it is not possible to let mc1 inherit ball and mc2 inherit cylinder. However, I guess you can make new classes on the fly. I wouldn't. 
> 
> Why not use composition?
> 
> / per
How can I make classes on the fly? Could you tell more about this?
Can you provide some links about composition?
0
Reply m4 1/17/2011 11:54:04 AM

3 Replies
323 Views

(page loaded in 0.053 seconds)

Similiar Articles:













7/23/2012 10:27:33 AM


Reply: