Should static_cast<Derived *>(Base pointer) give compile time error?

Posted by sandeep on Stack Overflow See other posts from Stack Overflow or by sandeep
Published on 2010-03-18T10:29:24Z Indexed on 2010/03/18 11:51 UTC
Read the original article Hit count: 207

Filed under:
|
class A
{
 public:
 A()
 {

 }
};

class B : public  A
{
 public:
 B()
 {
 }
};

int main()
{
A *a=new A();
B * b=static_cast<B*>(a);
}

© Stack Overflow or respective owner

Related posts about c++

Related posts about casting