home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!news.univie.ac.at!blekul11!frmop11!dearn!esoc!kkeyte
- Organisation: European Space Operation Centre (E.S.O.C)
- Date: Thursday, 10 Sep 1992 10:40:02 CET
- From: Karl Keyte <KKEYTE@ESOC.BITNET>
- Message-ID: <92254.104002KKEYTE@ESOC.BITNET>
- Newsgroups: comp.lang.c++
- Subject: Answers on a postcard...
- Lines: 25
-
-
- What does your compiler do with this one using the comma operator? I've
- had different results (and a very surprising order for calling operator
- members) from different compilers. Let me know 1) what you THINK (by
- looking at it) it should produce and 2) what you actually get?
-
- Karl
-
-
- #include <iostream.h>
-
- class X {
- private: int value;
- public: int operator , (int i) { return i+10; };
- int operator + (int i) { return value+i; };
- X & operator = (int i) { value=i; return *this; };
- };
-
-
- void main()
- {
- X x;
-
- cout << "Value is " << (x=1, x+1) << endl;
- }
-