August 2001
Beginner
482 pages
10h 52m
English
Constructors, like all member functions, can be overloaded. The capability to overload constructors is very powerful and very flexible.
For example, you might have a rectangle object that has two constructors: The first takes a length and a width and makes a rectangle of that size. The second takes no values and makes a default-sized rectangle. The compiler chooses the right constructor just as it does any overloaded function: based on the number and type of the parameters.
While you can overload constructors, you cannot overload destructors. Destructors, by definition, always have exactly the same signature: the name of the class prepended by a tilde (~) and no parameters.
Read now
Unlock full access