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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -