A
Andrey Vul
Given the following:
class AType;
class BType;
class CType;
AType *AType_init();
BType *BType_init();
CType *CType_init();
AType *a = AType_init();
BType *b = BType_init();
CType *c = CType_init();
class DType {
public: DType(AType& _a = *a, BType& _b = *b, CType& _c = *c) { }
};
Is it possible to call DType:Type() so that only _a and _c are
explicitly defined and _b uses default? Since C++ is agnostic to
constructor chaining, DType:Type(AType& _a = *a, CType& _c = *c)
{ DType(_a, *b, _c); } won't have the intended effect. Or will it?
Having commas causes syntax errors, but is there a way to call
constructors so that arguments L, M, and N (by argument index) are
explicitly defined without kludging up constructors as done in the
previous paragraph?
class AType;
class BType;
class CType;
AType *AType_init();
BType *BType_init();
CType *CType_init();
AType *a = AType_init();
BType *b = BType_init();
CType *c = CType_init();
class DType {
public: DType(AType& _a = *a, BType& _b = *b, CType& _c = *c) { }
};
Is it possible to call DType:Type() so that only _a and _c are
explicitly defined and _b uses default? Since C++ is agnostic to
constructor chaining, DType:Type(AType& _a = *a, CType& _c = *c)
{ DType(_a, *b, _c); } won't have the intended effect. Or will it?
Having commas causes syntax errors, but is there a way to call
constructors so that arguments L, M, and N (by argument index) are
explicitly defined without kludging up constructors as done in the
previous paragraph?