🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.help
Article #45

implicit member-wise assignment

#45
From: Gary Lipton
Date: Thu, 09 Apr 1992 05:46
21 lines
884 bytes
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?
Technical Details
Message-ID: <10299@inews.intel.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!iWarp.intel.com|inews!ajax!glipton

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!iWarp.intel.com|inews!ajax!glipton
From: glipton@ajax.intel.com (Gary Lipton)
Newsgroups: gnu.g++.help
Subject: implicit member-wise assignment
Message-ID: <10299@inews.intel.com>
Date: 9 Apr 92 05:46:54 GMT
Sender: news@inews.intel.com
Organization: Intel Corp, Chandler, AZ
Lines: 21