【发布时间】:2017-09-23 13:29:59
【问题描述】:
我搜索了很多类似成员函数委托的内容,但没有找到相关内容。也许我搜索了错误的单词...
我尝试执行以下操作:
class Foo1 {
int bar(int a, int b = 1, bool c = false);
int bar(int a, bool c);
}
// Can I write it like:
class Foo2 {
int bar(int a, int b = 1, bool c = false);
// This line is my question:
int bar(int a, bool c) : bar(a, 1, c);
}
我的编译器说只有构造函数采用初始化列表,但我想我在某处读到了类似上面的内容。仅构造函数采用初始化列表的规则是否有任何例外?
【问题讨论】:
标签: c++ function class initialization member