🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by John D. Sutter Fri, 10 Apr 1992 04:05
implicit member-wise assignment
#48
Author: John D. Sutter
Date: Fri, 10 Apr 1992 04:05
27 lines
1032 bytes
 [ posted for a friend -- jds ]

I am just learning C++.  My references tell me that "=" is
implicitly defined as member-wise assignment between operands
of a given class.

That is, if I have a class "Foo", then the code

   Foo foo1, foo2;

   foo1 = foo2;

is legal, and will copy the members of foo1 into foo2, without
an explicit declaration of "=".

But I find that using g++, I would need the statement

  Foo operator=(Foo);

in my Class declaration for this code to compile.

Is there a way to get g++ to provide implicit assignment?  Or
am I on the wrong track entirely?

Please send replies to glipton@sedona.intel.com; our news access
has been shut down recently.  Thanks.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads