> Eljay Love-Jensen wrote: >> Hi Eric, >> >> You should put a copy constructor in your Anton class. >> >> "Anton(Anton& a)" isn't a copy constructor. You need an "Anton(Anton >> const& a)". > Anton (Anton &), _is_ a copy constructor, it just isn't a const copy > constructor. > [12/1]/10 > > You'll be able to copy non-const objects, but not copy const ones. Sorry... maybe the example was somewhat too simple. An example, which is closer to what I need is the following (in "reality", f() is the constructor of another class, but the one below does not work either): class A { public: A( const A& ){} A( A& ){} A( int ){} A& ref(){return *this;} }; int f( A& ){ return 3; } int main (int, char **) { return f( A( 3 ) ); // error: could not convert `A(3)' to `A&' return f( A( 3 ).ref() ); // works } i wonder why it is not possible to convert to A& outside of the temporary object but inside. regards, Eric.