MotherClass destructor
I have a class Book with some the private attributes 'title' and 'author', which are vectors dynamically allocated into the heap by one constructor (There is also the default constructor Book() which only prints "book created") and deleted by the destructor; I have created a subclass Dictionary with only one constructor that calls the default Book constructor, so that its title and author are not allocated; the problem is the following: when I create a Dictionary object no dynamic memory is allocated, but exiting the scope of the object the Book destructor is called pretending to free dynamic memory that was not allocated, so an error appears; how can I solve it since my knowledge tells me that it's only possible to have one destructor per class
submitted by /u/MinuteSwan7413
[link] [comments]