mercredi 17 août 2016

c++ 11 class initialize error

why BASE *base_0 = new BASE(); //error? does it allocate memory when the class is defined?

class BASE {

public:
     int *i = new int(5);                              
     BASE *base_0 = new BASE();      
     static const BASE base_1;       
     static BASE base_2;             
    ~BASE() {
     cout << "~";
    }

};

Aucun commentaire:

Enregistrer un commentaire