Hello all. I am working with managed c++ ,cli. I am working on a large project and cannot afford to make any mistakes. In cli from what i have seen usually when i construct classes i use this ^ character to do so, like this

//header file
public ref class something{};

//cpp file
something ^ s;

My problem is with enumerations because you make enumerations without the ref i used for the class something it looks like the fallowing.

//header
public: enum class C{

//cpp
C c;

}

For anything else in managed c++ this would be unacceptable. Is there a ref enum class. If not will there be any problems associated with this. From what i can see this is mixing managed with un-managed, its usually not allowed, but at the moment the compiler lets it go. So whats the deal, and i good to go using it without the ref? thanks all for your eyes and time.

Recommended Answers

All 2 Replies

Will that compile?
I've only seen enums done one way (the same (primitive) way) in both managed or unmanaged code.

See this thread for how to code managed enumerations. There should be no colon after the word public.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.