c++错误

1,  ISO C++11 does not allow conversion from string literal to 'char *’

A:   c++编译器优化 会把字符常量只存一份, 当把字符常量赋值给char * 时,实际上暴露了字符常量的地址,意味着在程序中可以修改字符常量。

附上一个连接: https://blog.csdn.net/sszgg2006/article/details/7733330

2, Expression is not assignable

表达式不可赋值,表达式不能出现在赋值号的左侧,它的结果是一个引用,而引用不可被再次赋值。

3, dynamic_cast is not polymorphic        ’Symbol’ is not a reference or pointer

dynamic_cast 要求被转换的类型至少包含一个虚函数,它在程序运行时检查的就是这个多态性,它提供对指针或者引用的转换。附上连接:https://stackoverflow.com/questions/8469900/cant-downcast-because-class-is-not-polymorphic

dynamic_cast  和 static_cast 都提供编译期间的检查

原文地址:https://www.cnblogs.com/afraidToForget/p/8943756.html