Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


C + + foundation

Guidelines on how to visit sub-class object type father-members

What kind of father class target?
But you can use : (A class B : public)
A new *pa = A;
B = static_cast<B*> *pb (pa);
Do, the compiler links, but this is wrong. A target should not include B target.

-->

Static_cast<B*> (pa); How to understand?

-->
Not right? ? If the guidelines should be converted to Class-derived class, the derived class should be allowed at the base class Object ah, this polymorphic form of bars should dynamic_cast
A*pa=new B;
B*PB=static_cast<B*> (pa);
I doubt why they did not directly target the basic category at the derived classes of objects, changing the benefits? ?


It should be like this?
14.00 A;
Class B : public A{
Public :
Mem b ();
}
Class C : public A{
Public :
Mem c ();
}

.....

A *a;
If (. . . )
A=new B;
Else
A=new C

......

French b=dynamic_cast<B*> (a);
If (b)
B->b ();



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com