12 2017 档案
摘要:(1) 编译器处理方式不同 define宏是在预处理阶段展开。 const常量是编译运行阶段使用。 (2) 类型和安全检查不同 define宏没有类型,不做任何类型检查,仅仅是展开。 const常量有具体的类型,在编译阶段会执行类型检查。 (3) 存储方式不同 define宏仅仅是展开,有多少地方使
阅读全文
摘要:static_cast最像C风格的强制转换,很多时候都需要程序员自身去判断转换是否安全。但是相对C风格的强制转换,在无关类的类指针之间转换上,有安全性的提升。 dynamic_cast是运行时的转换吧,要求new_type为指针或引用,其二是下行转换时要求基类是多态的(基类中包含至少一个虚函数)。d
阅读全文
摘要:I am one of the person who has pricked my head in understanding the above question. Let me explain in my way...If you have virtual function or (let me
阅读全文