You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Eric Emminger <er...@ericemminger.com> on 2003/03/24 17:22:12 UTC

inheriting values from object instances

I need an object instance to be able to inherit *or* override the values 
from its parent instance.

<example>

For example, let's say we have a ProductExtension class that extends a 
ProductGroup class.

       ProductGroup
            |
     ProductExtension

An instance of ProductExtension can inherit or override the values of 
its parent ProductGroup instance.

So, if we have an instance of ProductGroup named 'group'

ProductGroup group = new ProductGroup();
group.setPrice(15);

and an instance of ProductExtension named 'ext'

ProductExtension ext = new ProductExtension();
ext.setProductGroup(group);

and ext inherits its price from group, then

ext.getPrice();

returns 15

Or, if we override the price on ext

ext.setPrice(8);

then

ext.getPrice();

returns 8.

</example>

Does Torque support this?
Is there a pattern for this?

Eric