home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!darwin.sura.net!sgiblab!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
- From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
- Subject: Re: operators
- Message-ID: <1993Jan26.214741.2681@ucc.su.OZ.AU>
- Keywords: operators,inheritance
- Sender: news@ucc.su.OZ.AU
- Nntp-Posting-Host: extro.ucc.su.oz.au
- Organization: MAXTAL P/L C/- University Computing Centre, Sydney
- References: <1993Jan21.165621.16704@jussieu.fr>
- Date: Tue, 26 Jan 1993 21:47:41 GMT
- Lines: 23
-
- In article <1993Jan21.165621.16704@jussieu.fr> clerc@gla.ecoledoc.ibp.fr writes:
- >
- >Id like to express in C++ the fact that operators < <= >= can
- >be defined using operators > and = (eg: a < b is b > a)
- >I would use a class MathObj (that would implement < <= >= using > and =)
- >and derive my classes from it, redifining only the basic operators > and =
- >
- >How can I WRITE that in C++ ? (no template solution please)
- >
-
- <cry> You cant, well, you can .. using macros.
-
- #define stdcmps(T) \
- friend int operator<=(const T& a, const T& b) \
- { return a<b || a==b; } \
- friend int .....
-
-
- --
- ;----------------------------------------------------------------------
- JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
- Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
- ;------ SCIENTIFIC AND ENGINEERING SOFTWARE ---ph: 2 799 8223 --------
-