harttle.github.io icon indicating copy to clipboard operation
harttle.github.io copied to clipboard

2015/08/25/effective-cpp-27

Open utterances-bot opened this issue 6 years ago • 2 comments

Effective C++ 27:最小化类型转换 | Harttle Land

C++的类型检查只在编译时执行,运行时没有类型错误的概念。理论上讲只要你的代码可以编译那么就运行时就不会有不安全的操作发生。但C++允许类型转换,也正是类型转换破坏了理论上的类型系统。

https://harttle.land/2015/08/25/effective-cpp-27.html

utterances-bot avatar Jun 18 '19 19:06 utterances-bot

SpecialWindowvirtual void blink();前面没有必要加virtual吧, base class的virtual function到derived class里还是virtual的。

ruixif avatar Jun 18 '19 19:06 ruixif

对,没必要。两者完全等价。加virtual的写法需要敲更多的字,但是更清晰。

harttle avatar Jun 19 '19 03:06 harttle