Ele*_*Ent 2 c++ constructor c++11 delegating-constructor
我有一个有两个构造函数的类.
class Foo { Foo(B b) {... } Foo(int n) : Foo(buildBFromInt(n)) {} ?? }
第一个需要一些对象,我想要第二个首先从更简单的类型创建对象.这可能吗 ?
Jar*_*d42 8
从C++ 11开始就有可能.它是委托构造函数,您使用正确的语法.
归档时间:
10 年,9 月 前
查看次数:
190 次
最近记录: