chamika.deshan 0 Newbie Poster

Hello
Is this safe?
In a API I am using have a protected inheritance of a class

class B
{
public :
 method();
}
class C : protected Class B
{

}

I need to access those pulbic methods in Class B
So is this ok and safe?

C* x = new C();
B* prt = reinterpret_cast<B*>(x);
prt->method();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.