I'd like to check how deleting an object via base-type pointer works. First case:
Base{int x};
Derived : Base {
int a;
};
Base *p = new Derived;
delete p;
Second case:
Base{int x};
Derived: Base {
vector<int> v;
}
Base *p = new Derived;
delete p;
1) Is it right that in first case there can't be any memory leaks and virtual destructor is not necessary? 2) Is it right that in second case there might be memory leaks as std::vector is likely implied via some dynamic memory allocation? And this means that virtual destructor is necessary in the second case?