Why does the following code produce error C2440: 'initializing' : cannot convert from 'Bar **' to 'Foo **'. Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast.
struct Foo
{
};
struct Bar : Foo
{
};
int main()
{
Bar **ppb = nullptr;
Foo **ppf = ppb;
return 0;
}
Aren't Foo and Bar related, so upcasting a pointer to pointer from one to another should work?