Prohibiting a Specific Attribute instance from being inherited!

Prohibiting a Specific Attribute instance from being inherited!

From: Muhammad Masoom Alam <>
Date: Wed, 21 Jun 2006 07:46:17 +0200
Message-ID: <>
Dear All,
I have a question which is both related with OCL and UML.

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 (the sub class of class B). That is,
based on the instance values of attr1, the attr1 is not inheritable
where as attr2 is inheritable. This kind of behavoiur can be specified
using OCL. Concretely, if i write an OCL expression
 context A
 inv: self.supertypes ->forAll ( s | not s.attr = "Not inheritable") //
supertypes is a MOF operation, that gives the direct supertypes of a
given type.

The problem is that in this way, all Class B instances, having an
attribute attr1 instance "Not Inheritable" will be forbidden from being
the super class of class A which is not desirable. I want, that only
this attribute is not inherited, but the other one (attr) is inherited
(i.e. the whole inheritence is not forbidden).

Thanking You in advance.

Received on Wed 21 Jun 2006 - 06:46:21 BST