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:
#include "stdafx.h"
#include "iostream"
using namespace std;
class vector{

vector str;
vector normal = str, array[10];
vector *pointerstr = &str, &refnormal = normal;

int _tmain(int argc, _TCHAR* argv[])
       return 0;
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. 
Share on Google Plus