Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. How to wrapp Friend function in managed c++?

How to wrapp Friend function in managed c++?

Scheduled Pinned Locked Moved Managed C++/CLI
tutorialc++question
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SudhaMakki
    wrote on last edited by
    #1

    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

    U 1 Reply Last reply
    0
    • S SudhaMakki

      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

      U Offline
      U Offline
      ursus zeta
      wrote on last edited by
      #2

      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[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups