X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: Help with Operator Overloading Date: 31 Mar 2004 12:40:45 GMT Organization: Aachen University of Technology (RWTH) Lines: 28 Message-ID: References: NNTP-Posting-Host: ac3b07.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 1080736845 13131 137.226.33.205 (31 Mar 2004 12:40:45 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 31 Mar 2004 12:40:45 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Chris wrote: > As a result of my last posting, I apparently have a little catching up > to do on the "new" C++ relative to updating my old programs. So, > here's another one for the DJGPP warriors: You actually are addressing the wrong tribe of warriors. This is a pure C++ language problem quite unrelated to DJGPP in particular, which you should be bringing to the attention of comp.lang.c++ instead. > weight=weight+(Matrix&)(rate*(Matrix&)DeltaWeight); I'm almost 100% certain you should neither need, nor use those casts to (Matrix&). C-style casts are generally frowned upon in modern C++, and I'd be very surprised if you needed them in the case at hand. > In my header file, I have also overloaded the double() function to > allow the casting of a 1x1 matrix into a double, I don't think that was a good idea. You can't meaningfully make the existence of such an override depend on a member variable (the size). Given that this will disrupt the automatic discovery of the right overloaded operators to use (as shown by your error message), I strongly suggest you get rid of the overloaded cast to double. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.