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

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
 
D

David Anton

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#
 
B

Bo Persson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top