这些操作符只为带有一个或多个虚函数的类返回动态类型信息,对于其他类型,返回静态(即编译时)类型的信息。
These operators return dynamic type information only for classes with one or more virtual functions. For all other types, information for the static (i. e. , compile-time) type is returned.
更多信息所带来的好处就是,可以更早地捕捉到某些类型的错误,而动态类型语言只有到运行时才能检测到这些错误。
One of the benefits of the additional information is the ability to catch certain kinds of errors that a dynamically typed language won't detect until run time.
毕竟,开始的时候可能觉得在一个动态语言中加入更多类型信息是多余的。
Initially, it may feel odd to add even more typing information to a dynamic language, after all.
应用推荐