home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
progc
/
bchelp10.arj
/
TI808.ASC
< prev
next >
Wrap
Text File
|
1991-09-17
|
2KB
|
67 lines
PRODUCT : Turbo C++ NUMBER : 808
VERSION : 1.01
OS : DOS
DATE : September 17, 1991 PAGE : 1/1
TITLE : Rules for Compiler Generated Constructors
The C++ language provides constructors when none are defined.
Here are the rules used by the Turbo C++ compiler to generate
such constructors:
The default constructor T::T() is automatically defined if there
are no constructors explicitly provided in the class definition.
The copy constructor T::T(constT&) or T::(T&) is automatically
defined if there is not a copy constructor explicitly provided in
the class definition. The copy constructor will call the copy
constructor of all base classes and member functions. It uses the
const form if it can, and the non-const form otherwise.
The assignment operator T& T::operator= (const T&) or (T&) is
defined if there is not an 'operator=' defined that has a 'T' or
'T&' as one of its arguments.
The copy constructor is not generated if there is a constructor
that can be called with a 'T' as its only argument.
The 'operator=' is not generated if there is a form with a 'T' as
any argument.
The copy constructor (or operator=) is called member-wise in the
generated version of these functions. If there is a member with
a private copy constructor (or operator=) than the FUNCTION is
not generated. I think that is not quite correct-- it ought to
work if this class is a FRIEND of that class. Also, the
operator= is not defined unless it is actually used.