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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. Typecasting Enum type

Typecasting Enum type

Scheduled Pinned Locked Moved Managed C++/CLI
c++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.
  • K Offline
    K Offline
    Katamneni
    wrote on last edited by
    #1

    Hi All i am wrapping up a MFC custom control in Managed C++ by subclassing it. I am having enum type in MFC which i want to expose to outside via Wrapper class.So i defined equivalent enum type in managed C++.How can i type cast from ManagedC++ to unmanaged type?Is there any otherway to avoid this redefinition? Thanks in advance Krishna

    N 1 Reply Last reply
    0
    • K Katamneni

      Hi All i am wrapping up a MFC custom control in Managed C++ by subclassing it. I am having enum type in MFC which i want to expose to outside via Wrapper class.So i defined equivalent enum type in managed C++.How can i type cast from ManagedC++ to unmanaged type?Is there any otherway to avoid this redefinition? Thanks in advance Krishna

      N Offline
      N Offline
      Nathan Blomquist
      wrote on last edited by
      #2

      How about this: namespace oldCpp { enum { myfirst = 0, mysecond }; } public __value enum newMCpp { myfirst = oldCpp::myfirst, mysecond = oldCpp::mysecond }; Then you could do something like: int oc = (int)newMCpp::myfirst; Untested, but should hopefully get you started. [edit] wrapped first enum in namespace. Learned this in another post in the VC forum. [/edit] Hope this helps, Nathan --------------------------- Hmmm... what's a signature?

      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