为什么会段错误
#include <iostream>
#include <typeinfo>
using namespace std;
class a
{
public:
virtual void r()
{
cout<<"aaa"<<endl;
}
~a()
{
cout<<"~aaa"<<endl;
}
};
class b:public a
{
public:
virtual void r()
{
cout<<"bbb"<<endl;
}
~b()
{
cout<<"~bbb"<<endl;
}
};
int main(void)
{
b l;
a* pp=dynamic_cast<a*>(&l);
pp->r();
delete pp;
pp=NULL;
return 0;
}