October 2011
Beginner to intermediate
1200 pages
35h 33m
English
As first discussed in Chapter 12, the compiler automatically generates certain public member functions, termed special member functions. The fact that it does so suggests that these special member functions are particularly important. Let’s look again at some of them now.
A default constructor is one that has no arguments, or else one for which all the arguments have default arguments. If you don’t define any constructors, the compiler defines a default constructor for you. Its existence allows you to create objects. For example, suppose Star is a class. You need a default constructor to use the following:
Star rigel; // create an object without explicit initialization ...
Read now
Unlock full access