home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!sun-barr!olivea!spool.mu.edu!sdd.hp.com!think.com!snorkelwacker.mit.edu!ai-lab!life.ai.mit.edu!tmb
- From: tmb@arolla.idiap.ch (Thomas M. Breuel)
- Newsgroups: comp.lang.c++
- Subject: defining cast operators outside classes
- Message-ID: <TMB.92Sep7162324@arolla.idiap.ch>
- Date: 7 Sep 92 20:23:24 GMT
- Sender: news@ai.mit.edu
- Reply-To: tmb@idiap.ch
- Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
- Perceptive)
- Lines: 15
-
- Apparently, it is impossible to define a conversion operator for a
- class without making the conversion operator a member function.
-
- It would be very useful to be able to define something like the
- following without having to modify either class MyMatrix or class
- TheirMatrix:
-
- operator MyMatrix(TheirMatrix &m) {
- ...
- }
-
- Why was this seemingly arbitrary restriction made? Can it be
- eliminated in the next version of C++?
-
- Thomas.
-