home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13362 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  891 b 

  1. Path: sparky!uunet!sun-barr!olivea!spool.mu.edu!sdd.hp.com!think.com!snorkelwacker.mit.edu!ai-lab!life.ai.mit.edu!tmb
  2. From: tmb@arolla.idiap.ch (Thomas M. Breuel)
  3. Newsgroups: comp.lang.c++
  4. Subject: defining cast operators outside classes
  5. Message-ID: <TMB.92Sep7162324@arolla.idiap.ch>
  6. Date: 7 Sep 92 20:23:24 GMT
  7. Sender: news@ai.mit.edu
  8. Reply-To: tmb@idiap.ch
  9. Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
  10.     Perceptive)
  11. Lines: 15
  12.  
  13. Apparently, it is impossible to define a conversion operator for a
  14. class without making the conversion operator a member function.
  15.  
  16. It would be very useful to be able to define something like the
  17. following without having to modify either class MyMatrix or class
  18. TheirMatrix:
  19.  
  20.     operator MyMatrix(TheirMatrix &m) {
  21.         ...
  22.     }
  23.  
  24. Why was this seemingly arbitrary restriction made? Can it be
  25. eliminated in the next version of C++?
  26.  
  27.                     Thomas.
  28.