Extending Multiple Components

Extending Multiple Components

Post by jorgeloy » Fri, 11 Feb 2005 03:08:56



I have an application that will have multiple components, but I would like to
have one major component that extends all the other components so that I
reference only one component in the CFM pages.  Does this make sense? One
Application component that extends ALL the other components.
 
 
 

Extending Multiple Components

Post by Mike Nime » Fri, 11 Feb 2005 05:36:00


You can only extend 1 component. However you can chain components

component 1
    extends component 2
        which extends component 3
            and so on.

hth,
---nimer


Quote:>I have an application that will have multiple components, but I would like
>to
> have one major component that extends all the other components so that I
> reference only one component in the CFM pages.  Does this make sense? One
> Application component that extends ALL the other components.


 
 
 

Extending Multiple Components

Post by Adam Camero » Fri, 11 Feb 2005 21:07:25


What you're wanting to do doesn't really make sense.

When a class extends another class, it is specialising the original class.
Take this example:

Class: Mammal
Class: Dog extends Mammal
Class: Labrador extends Dog

etc

You can test the validity of what extends what by asking whether there's an
"IS A" relationship between the extending and extended classes:

A Dog is a Mammal.  A Mammal is an Animal.

That's OK.

I guess, strictly speaking, a class could have more than one "IS A"
relationship, but it's just not done in OO programming.

What you're trying to do is more a "HAS A" relationship, which suggests
your uber class should probably have instance variables of each of the
other classes you're wanting to include in this uber class.

A Dog has a Tail, so the dog class would have a member variable of type
Tail.

Make sense?

--

Adam