Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C - C++ Learning > downcasting I ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 4294 of 4370
Post > Topic >>

downcasting I couldnt success

by emre <emreesirik@[EMAIL PROTECTED] > Oct 4, 2008 at 01:21 PM

class A {
.....

};
class B : public A {
.......
};

int main( )
{
      stack <A> mystack;
      A *myA = new B( );
      mystack.push(*myA);
      .
      .
      .
      A newA = mystack.top( );
      B  newB = (B) newA;   // why is doesnt work???
}


downcast doesnt work,  do you have any idea to do it?
 




 4 Posts in Topic:
downcasting I couldnt success
emre <emreesirik@[EMAI  2008-10-04 13:21:05 
Re: downcasting I couldnt success
Ian Collins <ian-news@  2008-10-05 09:39:43 
Re: downcasting I couldnt success
Ulrich Eckhardt <dooms  2008-10-05 08:16:14 
Re: downcasting I couldnt success
Francis Glassborow <fr  2008-10-05 13:35:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 15:12:22 CST 2008.