#include "iostream"
class A {
private:
int a;
public :
A(): a(-1) {}
int getA() {
return a;
}
};
class A;
class B : public A {
private:
int b;
public:
B() : b(-1) {}
int getB() {
return b;
}
};
int main() {
std::auto_ptr<A> a = new A();
std::auto_ptr<B> b = dynamic_cast<std::auto_ptr<B> > (a);
return 0;
}
錯誤:無法將dynamic_cast`(&一) - >性病:: auto_ptr的< _TP> ::得到()const的爲什麼auto_ptr的dynamic_cast失敗?
哪裏的:: get()聲明? – cbrulak 2009-02-06 03:44:02