[comp.lang.eiffel] Extension of class REAL

roosen@cstw56.prl.philips.nl (Monique Roosen) (06/15/90)

Sorry for wasting your time. Because I'm not familiar with our news-
server I forgot to replace the subject heading in my previous posting.
Fearing that people would skip this article due to a wrong subject
header I repeat the posting here with the corrected subject-header.
If you want to flame me for this, go ahead :-) Yippee my first flames.

This is a follow-up to a previous message with respect to the extension
of a STRING class. It can be placed in the same context.

I want to make a class POS_REAL like :

         class POS_REAL
               inherit FLOAT
         -- maybe some extra features
               -- class invariant
               invariant
                    Current >= 0.0
         end -- class POS_REAL

Of course I get the following error-message with respect to the invariant
line :

         Type mismatch: REAL is not a descendant class of POS_REAL
         Incorrect type for argument number 1 of _infix_ge

I suppose the following assignment won't work either :

         x : POS_REAL ;
         x := 1.2

The work-around for the STRING class was the share-feature, but this
feature is not available within the FLOAT class.

Is there anybody out there who knows a solution for this problem ??
Is ISE thinking of a change for these basic class types ??

Thanks in advance.

Monique