std::dynamic_pointer_cast
encountered an error source type is not polymorphic
The reason is that the type to be converted is not polymorphic, that is, there is no virtual function
Simply define the destructor of the base class as a base class
virtual ~A() = default;