Class declaration doesn’t cause any memory allocation because the memory is allocated only when we declare specific object. Class is just a data type, so declaration of objects follows the usual syntax in which after the identifier type we state identifiers of objects separated by commas:
using namespace std;
vector normal = str, array;
vector *pointerstr = &str, &refnormal = normal;
int _tmain(int argc, _TCHAR* argv)
With this type of command we’ve defined five objects and these objects are:
- First object: str doesn’t have initialization code so elements of vectors of str after its creation have values which are default constructors.
- Object normal have initializer which says that object is initialized so that is logically the same to the object str.
- If the class doesn’t specify otherwise, initialization is carried out so that each join all the elements of the object str to object normal. Class can define the special procedure for initialization with help of copy constructor.