Which is the difference between these two codes? Is there a memory leak in the first case?
no destructor defined
class Library
{
private:
Book books[50];
int index;
public:
Library()
{
index=0;
}
};
or with destructor defined
class Library
{
private:
Book *books;
int index;
public:
Library()
{
books=new Book[50];
index=0;
}
~Library()
{
delete books;
}
};