J
jmd
hello.
i am trying VC++ 7.1 (with vsnet 2003).
my example :
class Complex
{
public:
Complex ( float re_ = 0.0, float im_ = 0.0 ) : re(re_), im(im_) {}
float Re () { return ( re ); }
float Re ( float re_ ) { return ( re = re_ ); }
float Im () { return ( im ); }
float Im ( float im_ ) { return ( im = im_ ); }
Complex operator+= ( Complex c ); // <=== problem or not ?
private:
float re, im;
};
the above code compiles & executes whithout errors (also Disable Language
Extensions set to YES).
it seems to me that a c++ method of a class could not return an objet of
that class, but only a reference (&) or pointer (this) to an object of this
type !!!
can you give me an explanation ?
thank you.
jean-marie.
i am trying VC++ 7.1 (with vsnet 2003).
my example :
class Complex
{
public:
Complex ( float re_ = 0.0, float im_ = 0.0 ) : re(re_), im(im_) {}
float Re () { return ( re ); }
float Re ( float re_ ) { return ( re = re_ ); }
float Im () { return ( im ); }
float Im ( float im_ ) { return ( im = im_ ); }
Complex operator+= ( Complex c ); // <=== problem or not ?
private:
float re, im;
};
the above code compiles & executes whithout errors (also Disable Language
Extensions set to YES).
it seems to me that a c++ method of a class could not return an objet of
that class, but only a reference (&) or pointer (this) to an object of this
type !!!
can you give me an explanation ?
thank you.
jean-marie.