Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!uunet!philmtl!philabs!linus!sdl From: sdl@linus.UUCP (Steven D. Litvintchouk) Newsgroups: comp.lang.smalltalk Subject: subclasses of Float in Smalltalk/V Message-ID: <56225@linus.UUCP> Date: 16 Jun 89 20:31:37 GMT Organization: The MITRE Corp., Bedford, MA Lines: 40 I currently own a copy of Smalltalk/V for the Mac. I am trying to create some subclasses of Float. For example, subclass Degree, which would be constrained to have values in the range 0.0 .. 360.0. (For example, adding an instance of Degree to another instance of Degree would return the sum mod 360.0.) The problem is: How can you create instances of class Degree? I tried: Degree fromInteger: 50 But fromInteger is apparently a primitive which returns a Float. I also tried Degree new But Smalltalk/V considers the expression (Float new) to be an error. I guess the problem is how to implement a conversion method for class Float called "asDegree," which will return an instance of class Degree equal to the Float number mod 360.0. I see no way to accomplish this in Smalltalk/V. Any ideas? Steven Litvintchouk MITRE Corporation Burlington Road Bedford, MA 01730 Fone: (617)271-7753 ARPA: sdl@mitre-bedford.arpa UUCP: ...{att,decvax,genrad,ll-xn,philabs,utzoo}!linus!sdl "Those who will be able to conquer software will be able to conquer the world." -- Tadahiro Sekimoto, president, NEC Corp.