class Complex{ public: Complex(){Re=-4.;Im=-4.;} Complex(float a, float b){Re=a;Im=b;} float GetRe()const{return Re;} float GetIm()const{return Im;} private: float Re; float Im; }; class Container{ public: Container(){} private: //Complex * pippo; // this does not Complex pippo //this calls def ctor }; int main(){ Complex A[100]=Complex(1,2);// static array, calls par ctor (allocated on the stack) Complex *B[100];// array of pointers to Complex, does not call ctor (allocated on the stack) Complex *C=new Complex[100]; // dynamic array of Complex, calls default ctor (allocated on the heap) for(int i=0;i<100;i++){ B[i]=new Complex(1,2); //B[i] is a pointer on the stack, pointing to an object allocated on the heap C[i]=Complex(3,4); //C[i] is an object, allocated on the heap } delete [] C; for(int i=0;i<100;i++)delete B[i]; //must delete each pointed object for(int i=0;i<100;i++){ //cout << A[i].GetRe()<< endl; //cout << B[i]->GetIm()<< endl; //cout << C[i].GetRe()<< endl; } return 0; }