std::dynamic_pointer_cast 遭遇错误 source type is not polymorphic

std::dynamic_pointer_cast 遭遇错误 source type is not polymorphic

原因就是要进行转换的类型不是多态的,即没有虚函数

简单的将基类的析构定义成基类就行了

virtual ~A() = default;

你可能感兴趣的:(std::dynamic_pointer_cast 遭遇错误 source type is not polymorphic)