If I have two dynamic arrays as private data members:
std::string* first_array;
std::string* second_array;
I know I can simply delete like this in the destructor
myClass::~myClass()
{
   delete[] first_array;
   delete[] second_array;
}
The concern I have is this, not all the time do I have data inside both array, so is something like this considered best practice ?
myClass::~myClass()
{
   if(first_array)
       delete[] first_array;
   if(second_array)
       delete[] second_array;
}
I tried both and it both worked, not sure which one is better in terms of performance.
 
     
    