tags:

views:

327

answers:

1

I know that there is no way to do this in pure C++, but I was wondering if it is possible to call a constructor from another constructor's initialization list in C++/CLI, same way one can do it in C#.

Example:

ref class Foo {
  Foo() {}
  Foo(int i) : Foo() {}
}
+3  A: 

It is called a "delegating constructor". It is not available in the language yet. But there's a formal proposal, you'll find it in annex F.3.1 of the language specification. Given Microsoft's stance towards C++/CLI, that is unlikely to see the light of day anytime soon.

Hans Passant