Inheritance

    Inheritance of Figure by Circle is declared as

 

class Circle subclassOf Figure
   ...
end

 

Multiple inheritance is not supported although multiple subtyping is.

    Class AnyClass is inherited by any class that does not inherits from any other class. AnyClass inherits from Any that defines useful methods as deepClone and shallowEqual. Methods may be declared in a subclass section of a class. These methods can only be accessed in subclasses.

    An assertion defined for a superclass method is also valid in the subclass if the subclass method does not redefine the assertion clause. Then, if one defines a class

class Stack
   public:
     proc push( x : integer )
       assert
         before not full();
         var oldSize = getSize();
         after  not empty() and oldSize == getSize() - 1;
       end
     begin  // method body
     ...
     end  // push
   ...
end

and creates a subclass

class MyStack subclassOf Stack
  public:
    proc push( x : integer )
      begin
        // push body
      ...
      end  // push
    ...
end

the push method will have to obey the assertion of method push of Stack. This allows the programmer to reuse method specification given by assert clauses. This feature was brought from Eiffel.
 

What is new ?

    Nothing.

Return