Calling constructor from another constructor

In C# you can call a contructor from another constructor like this:

class Test
{
Test() : this(0)
{
}
Test(int i)
{
}
}

Is there C++/CLI syntax to accomplish the same (for a managed class of course)


Answer this question

Calling constructor from another constructor

  • Paul Mehner

    Thanks for the reply Nishant!


  • Nick Colebourn

    Bekas wrote:
    In C# you can call a contructor from another constructor like this:

    class Test
    {
    Test() : this(0)
    {
    }
    Test(int i)
    {
    }
    }

    Is there C++/CLI syntax to accomplish the same (for a managed class of course)

    No, not currently. Delegating constructors are mentioned in the "future directions" section of the standard, so I am assuming they will be featured in a future version, perhaps in Orcas.



  • Calling constructor from another constructor