Wondering if anyone can explain why unique_ptr is breaking inheritance accessor, for instance:
class Base {
};
class Derived : private Base {
};
int main() {
Base* pointer = new Derived;
return 0;
}
This will correctly cause a compile time error, because Derived is inheriting from Base using private keyword. So no one outside of Derived should know the relationship between Derived and Base. But if I do:
unique_ptr<Base> pointer = unique_ptr<Base>(new Derived);
Instead of:
Base* pointer = new Derived;
The code compiles and runs fine...