186: Highlights
Constructors perform computations, such as initial member variable assignment, that you want to occur when your program creates a class object.
Each constructor is named for the class in which it is defined, and no constructor has a return-value data type.
The default constructor has no parameters. You should include a definition of a default constructor in every class that you define.
If
you want to initialize a class object's member-variable values using the default constructor,
then
use the following pattern:
class name
variable name
;
If
you want to initialize a class object's member-variable values using another constructor, with parameters,
then
use the following pattern:
class name
variable name
(
argument 1
, ...,
argument n
);