home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12427 < prev    next >
Encoding:
Text File  |  1992-08-17  |  1.1 KB  |  35 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!mcsun!Germany.EU.net!news.netmbx.de!zrz.tu-berlin.de!math.fu-berlin.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!stepsun.uni-kl.de!sun.rhrk.uni-kl.de!efes.physik.uni-kl.de!kring
  3. From: kring@efes.physik.uni-kl.de (Jochen Voss)
  4. Subject: classes for algebraic structures - need help
  5. Message-ID: <1992Aug17.145449.5259@rhrk.uni-kl.de>
  6. Sender: kring@efes.physik.uni-kl.de (Thomas Kettenring)
  7. Organization: FB Physik, Universitaet Kaiserslautern, Germany
  8. Date: Mon, 17 Aug 1992 14:54:49 GMT
  9. Lines: 24
  10.  
  11. I want to implement some classes for groups, rings, ... . I wanted to write some abstract
  12. classes like
  13.  
  14. class group {
  15. public:
  16.     virtual  group  operator+(group) = 0;
  17.     ...
  18. }
  19.  
  20. and to derive classes for real groups like Z[2] ( {0,1}, 0+0 == 1+1 == 0, 0+1 == 1+0 == 1 ).
  21. But how do I do this: I want to override the operator+ with something like
  22.  
  23.     z2  operator+(z2);
  24.  
  25. because only elements of type z2 (and not of type group) can be added to elements of type z2.
  26. How do I do this.
  27.  
  28. Please mail me!
  29.  
  30. --
  31. VinK - Voss is not Kring
  32.  
  33. You can e-mail me at `kring@physik.uni-kl.de'.
  34. (use `c/o Jochen' in the Subject)
  35.