How to wrapp Friend function in managed c++?
-
Hi, I am able to wrapp all the class method in unmanaged c++ into managed c++ but i could't able to wrapp Friend function. Please let me know if you have any idea. Here is an example Class UnManaged{ int i; public: UnManaged(int k){ i =k;} friend int getInt(){return i}; friend bool operator < (Unmanaged *U1, Unmanaged *U2) {return (U1->i i);} } How can wrapp These two function in my wrapper class called Mangaed. public __gc class Managed { Unmanaged __nogc *unmanagedObject public: Managed(){unManagedObject = new Unmanaged(10); } Thanks in Advance. -Sudhakar
-
Hi, I am able to wrapp all the class method in unmanaged c++ into managed c++ but i could't able to wrapp Friend function. Please let me know if you have any idea. Here is an example Class UnManaged{ int i; public: UnManaged(int k){ i =k;} friend int getInt(){return i}; friend bool operator < (Unmanaged *U1, Unmanaged *U2) {return (U1->i i);} } How can wrapp These two function in my wrapper class called Mangaed. public __gc class Managed { Unmanaged __nogc *unmanagedObject public: Managed(){unManagedObject = new Unmanaged(10); } Thanks in Advance. -Sudhakar
Seems like I read somewhere that friend functions are not allowed in managed classes. Constraints: A __gc class shall not declare or define friend classes or functions. Read this: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmxspec/html/vcManagedExtensionsSpec_4.asp[^]