Does it seems logical to statically cast base pointer to Derived ...static_cast<Derived *> (Base poi

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 10:31 UTC
Read the original article Hit count: 398

Filed under:
|
class A
{
 public:
 A()
 {
 cout<<"In A";
 }
};

class B : public  A
{
 public:
 B()
 {
 cout<<"In 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