jrmartinezb
Programmer
Ive been looking for patterns trying to solve this problem but have found none so far
C1 has an atribute a1 of type C3
C2 is a subclass of C1
BUT:
Attribute a1 in a1 should alwasys belong to class C4, wich is a subclass of C3.
(eg all clsCars have clsWheels, but clsRaceCars have clsWideWheels)
This seems like a fairly common modeling scenario, but I havent found an approach that makes me feel entirely comfortable. My only solution so far is to throw an exception if an attempt is made to set the value of an attribute to something other that what is allowed
Thanks in advance
PS
Pardon my english, not my language.
C1 has an atribute a1 of type C3
C2 is a subclass of C1
BUT:
Attribute a1 in a1 should alwasys belong to class C4, wich is a subclass of C3.
(eg all clsCars have clsWheels, but clsRaceCars have clsWideWheels)
This seems like a fairly common modeling scenario, but I havent found an approach that makes me feel entirely comfortable. My only solution so far is to throw an exception if an attempt is made to set the value of an attribute to something other that what is allowed
Thanks in advance
PS
Pardon my english, not my language.