My question is the following : is this following code correct :
class A {}; // no virtual destructor
class B : public A{
std::unique_ptr<int> ptr{new int(5)};
};
// in main
std::unique_ptr<A> = new B;
It will probably have some compilation errors, but it is just to understand the concept. Will the pointer be correctly deleted (I mean ptr will be deleted?) or do we need virtual destructor to ensure that