views:

52

answers:

1

I have an interface defined in C# which has a method

Array[] Foo();

I need to implement this interface in a class written in C++/CLI. i tried the following syntax

array<array<Object^>^>^ Foo();

But i get an error stating my return type does not match the one in the interface. Does anyone know how to translate a C# Array[] to C++/CLI?

+4  A: 

I'd say the syntax is:

cli::array<Array^>^ Foo(); 
jdv
array<Array^ >^ Foo() turned out right. Thank you. I wish i knew why, but it works.
eithan
@eithan: please close your question by marking this correct answer. Click the big check mark next to this post.
Hans Passant
@eithan: as for the why: The ^'s are there to signify that the object is passed by reference(managed pointer). This is redundant, but it is in the spirit of the C++ syntax. Without it, a C++ mind may misread the above declaration. The redundancy ensures everybody reads it the same. (P.S. my fingers hurt after a day C++/CLI).
jdv