ref class CFoo { public: ref struct FooStructure { int i; }; void Func(IFoo^ myI) { myI->Func(gcnew FooStructure()); } }; interface class IFoo { public: void Func(CFoo::FooStructure^ s); }; 

Writes the following: Function "IFoo::Func" cannot be called with the given argument list argument types are: (CFoo::FooStructure ^) object type is: IFoo ^ .

Um ... You can not transfer the structures belonging to classes in the methods of the interface?

  • Structures are passed by value. Therefore, remove the ^ character in the interface declaration. - Alexander Petrov
  • None of this will come of course. We have a managed class. - D .Stark
  • The problem is that the structure is declared in the class. The only strange thing is that if we declare this structure in another managed class, then everything will work. - D .Stark
  • In theory, what's the difference? .. - D .Stark
  • one
    No You are trying to write in C ++ like in C #, but this does not work. Either both should be done inside the CFoo, or both outside. - MSDN.WhiteKnight

0