tags:

views:

28

answers:

1

Hi,

In my E-commerce application, I want to add a attribute to a Product, only after it was added to a Category.(Not all Products are in a Category here). How can I design the Product class?

Thanks in advance!

A: 

// Or am I missing something?

if (_category != null) AddAttribute(...);

John Lockwood
Thanks! But I mean how to design the objects. To have a Product object hold a nullable reference to Category, or use other OO techniques.
Roy