Essence of the question. There is a class:
class a { private: int **something; public: a(); ~a(); }; Actually, how to allocate memory for a two-dimensional dynamic array? Or rather, where? Some sources indicate that it is necessary not to “overload” the constructor with unnecessary calculations and memory allocation, but to put everything in a different method.
a(){something = nullptr;} void doMemory(){ /* выделение памяти */ } ~a(){if(something != nullptr) /* высвобождаем */);} In my opinion, “shove everything into another method” is interesting if we create more objects and they just lie in memory and wait in the wings, and when this hour comes, we take an object to allocate memory for it and immediately work with it, and then lies waiting in the wings.