class A
pro x from var = 1
def setX(x as int)
_x = x
class B inherits A
invariant
.x > 0
def foo
pass
class P
def main
b = B()
b.foo
b.x = 0 # should fail B's invariant
b.setX(0) # should fail B's invariant
Any Eiffel users out there? Am I correct that B's additional invariant (.x > 0) should cause an exception when members inherited from A (.x and .setX) are used to violate it?
Currently the above code executes with no exceptions because the member's of A don't bother to check invariants (due to their not being any invariants for A). I think this is a bug. Comments welcome.
-Chuck