Init
This commit is contained in:
28
02-Note/读书笔记/深入理解c++11/第三章.md
Normal file
28
02-Note/读书笔记/深入理解c++11/第三章.md
Normal file
@@ -0,0 +1,28 @@
|
||||
#### 继承构造函数
|
||||
```
|
||||
struct A{
|
||||
void f(double i){}
|
||||
|
||||
A(){}
|
||||
|
||||
A(int i){}
|
||||
|
||||
A(float f){}
|
||||
};
|
||||
|
||||
struct B:A{
|
||||
using A:A;
|
||||
|
||||
using A:f;
|
||||
|
||||
void f(double i){}
|
||||
}
|
||||
|
||||
int main(){
|
||||
B b;//会调用A的对应构造函数
|
||||
b.f;//会调用A的函数
|
||||
}
|
||||
```
|
||||
不过使用了继承构造函数,就无法通过构造函数初始化派生类成员了。
|
||||
#### 用户自定义字面量
|
||||
可以定义出2.0f或者123_w之类的写法,表达瓦特与浮点
|
Reference in New Issue
Block a user