N
news.ir.com.au
Hi,
In the following code I get the compiler error:
error C2243: 'static_cast' : conversion from 'class B *' to 'class A *'
exists, but is inaccessible
I understand why I get this error and can usually get around the situation
by inserting a "using A::..." statement inside class B, however, due to this
being a static cast, what is the syntax?
--------
class A
{
};
class B : private A
{
};
int main(int argc, char* argv[])
{
B* b;
A* a;
a = static_cast<A*>(b);
return 0;
}
Thanks,
David
In the following code I get the compiler error:
error C2243: 'static_cast' : conversion from 'class B *' to 'class A *'
exists, but is inaccessible
I understand why I get this error and can usually get around the situation
by inserting a "using A::..." statement inside class B, however, due to this
being a static cast, what is the syntax?
--------
class A
{
};
class B : private A
{
};
int main(int argc, char* argv[])
{
B* b;
A* a;
a = static_cast<A*>(b);
return 0;
}
Thanks,
David