C++语法 34条勘误
sterben-01 opened this issue · comments
在34条中提到的:
Student(int r){ //转换构造函数,形参是其他类型变量,且只有一个形参
this->age = r;
this->num = 1002;
};
关于转换构造函数的定义已经更新:
不以说明符explicit声明 且可以用单个参数调用 (C++11 前) 的构造函数被称为转换构造函数(converting constructor)。
来自:https://zh.cppreference.com/w/cpp/language/converting_constructor
从C++11起,多个参数的非explicit构造函数也可以是转换构造函数。