Mathias Fr�hlich schrieb:

On Freitag 10 Dezember 2004 03:40, Jon Berndt wrote:
This gives me an odd error:

 non-static const member `AnotherClass* const ptrToAnotherClass', can't use
default assignment operator

If I remove the const specifier from the declaration for ptrToAnotherClass,
and then move the assignment at the copy constructor into the code (instead
of doing the "const thing" in the initializer list), then the compile
works.
That is something which is, I believe, missinterpreted by some compilers.
You have a constant value and as such it cannot change. Initial assignment is a change and so you cannot assign that one.
Your compiler seems to allow such an assignment for static members, but not for nonstatic members.

When the initial assignment happens in such a way as Jon has written it

  foo( const bar& b ) : foobar( b.foobar )
  {
     // whatever
  }

it is fine. When the assignment happens inside the contructor (or anywhere else), like

  foo( const bar& b )
  {
     foobar = b.foobar;
     // whatever
  }

then it can't work due to the const of foobar.

But I don't know at the moment, why Jons code doesn't work :(

CU,
Christian


_______________________________________________ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel 2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to