c++ - Is there a difference when class contains empty destrcutor or not -
is there difference between class::
class osoba{ public: char* imie; int wiek;  osoba(char* imie, int wiek){     this->imie = imie;     this->wiek = wiek; } }; without destructor ~osoba(){delete imie;} or it? correct in both cases?
there important difference.
you're getting char* imie constructor (implies didn't new that), shouldn't delete that. don't use delete *imie; unless know doing.
the class/object new pointer responsible delete it, organize code in way. 
Comments
Post a Comment