TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ROGER SCUDDER
from: BILL GODFREY
date: 1998-02-25 15:40:00
subject: Not so sloppy after all

On 14 Feb 98, Roger Scudder snarfled at Darin McBride and muttered thus:
 RS>  Getting back to the language at hand.  What is the difference between
 RS>  a constructor and a copy constructor?
A copy constructor is a constructor. A constructor is called when an instance 
of a class comes into being. This includes;
Globals and statics, when the program starts, just before main(). Locals, at 
the point of the code when the instance is declared. Pointers to classes, 
when the class is new'd.
A copy constructor takes one parameter, a const reference to another instance 
of the same class.
It's job is to copy data from the stated instance to the constructed object, 
including any memory allocation.
Decalre a copy ctor (for an example class X) with...
X::X(const X&)
{ 
        // blah blah blah
}
I could be wrong.
---------------------------------------
What happens when a machine who's sole function is to fix itself, breaks 
wn?
Bill, president of the "knows what a copy constructor is" society.
--- Spot 1.3a Unregistered
---------------
* Origin: (2:2500/702.25@FidoNet)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.