In C++ /CLI is there a "MyClass( ) : this( )" type of constructor like in C#?

  • Thread starter Thread starter Howard Swope
  • Start date Start date
H

Howard Swope

Does this type of thing exist in C++ /CLI as in C#



public class A

{

public A(int foo)

{

}



public A( ) : this(0)

{

}

}



???



Thanks
 
No - calls to same-class constructors are not allowed in C++. Someone else
can probably better explain the rational for this restriction.
--
http://www.tangiblesoftwaresolutions.com
C++ to C#
C++ to VB
C++ to Java
Instant C#: VB to C#
Instant VB: C# to VB
Instant C++: VB or C# to C++/CLI
Java to VB & C# Converter: Java to VB or C#
 
David said:
No - calls to same-class constructors are not allowed in C++.
Someone else can probably better explain the rational for this
restriction.

It just wasn't considered important enough during the standardisation
process. There are some intricate details in defining exactly what it
means, and when the object is supposed to be "fully constructed".

In the next revision of the C++ standard, this will have been worked
out.


Bo Persson
 
Back
Top