Re: Prohibiting a Specific Attribute instance from being inherited!



Re: Prohibiting a Specific Attribute instance from being inherited!

From: Muhammad Masoom Alam <muhammad.alam_at_uibk.ac.at>
Date: Wed, 21 Jun 2006 10:01:59 +0200
Message-ID: <4498FCF7.4000405@uibk.ac.at>
Hi Jim,

Thanks for the prompt response. Infact, the proposed solution does work
for my requirements. I want to have a run time solution. That is based
on the instance values of an attribute, it is decided that whether it is
inheritable or not. This has been done in MOF. The example i quoted was
taken from MOF specification .

context GeneralizableElement
inv: self.supertypes -> forAll ( s | not s.isLeaf)

Description: A GenerlizableElement cannot inherit from a
GeneralizableElement defined as "leaf"(, i.e. run time behaviour checking).

The problem is that it forbid the complete inheritence, where my
requirement is only for one attribute not the whole class.

Best Regards,
MA



Jim Steel wrote:

>
>
> I agree with Greg. Subclassing generally doesn't let you pick and
> choose which bits of the superclass you inherit.
>
> (Without knowing the metamodel) Extract the inheritable attribute into
> an abstract superclass C and have both A and B inherit C.
>
> Jim.
>
>
>
>
> Muhammad Masoom Alam wrote:
>
>> Is this the only solution to re-organise the hierarchy and how?
>>
>> MA
>>
>> Greg O'Keefe wrote:
>>
>>>> I have a class A and a class B where B is the super class of class A.
>>>> Class B contains an attribute att1 and an attribute att2. The
>>>> question is that how is this possible to forbid the inheritence of
>>>> only att1 attribute to class A
>>>>   
>>>
>>>
>>> Reorganise your class hierarchy?
>>>
>>>
>>>
>>>
>>> To remove yourself from this list please mail
>>> puml-list-request@cs.york.ac.uk
>>> with a message containing the word "unsubscribe".
>>>
>>>  
>>>
>
>
>
>
> To remove yourself from this list please mail
> puml-list-request@cs.york.ac.uk
> with a message containing the word "unsubscribe".
>
Received on Wed 21 Jun 2006 - 09:02:03 BST