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?

1 Answer 1

7

I'd say the syntax is:

cli::array<Array^>^ Foo(); 
Sign up to request clarification or add additional context in comments.

3 Comments

array<Array^ >^ Foo() turned out right. Thank you. I wish i knew why, but it works.
@eithan: please close your question by marking this correct answer. Click the big check mark next to this post.
@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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.