摘要: [toc] C和C++中定义了 引用类型(reference type) ,存在左值引用(lvalue reference)。而在C++11中,新增了 右值引用(rvalue reference) 这一概念, 虽然个人感觉右值引用用处不大,但在此一并讨论。 1.左值and右值 首先,我们讨论左值和右 阅读全文
posted @ 2019-03-14 14:51 Bylight 阅读(8891) 评论(1) 推荐(4) 编辑
摘要: C++中可以将 构造函数 声明为explicit型,以避免后台类型转换(behind the scenes tyoe conversions) 我们先来看这样一个模拟int的类 在C++中,默认允许隐式类型转换(implicit type conversion),但这破坏了强类型化(strong t 阅读全文
posted @ 2019-03-14 14:03 Bylight 阅读(215) 评论(0) 推荐(0) 编辑