db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Emminger <e...@ericemminger.com>
Subject inheriting values from object instances
Date Mon, 24 Mar 2003 16:22:12 GMT
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


Mime
View raw message