Question

I've just seen some (presumably) C++ code which sports two "keywords" unknown to me (I'm assuming keywords but, since I have no context, they may be simple #define things).

They also don't seem to appear in the C++11 standard, at least the draft I have but, since that's a pretty late draft, I can't imagine them being just dropped into the standard at the last minute. They are ref and sealed.

The code I found them in was something like:

public ref class DevIface sealed {
    private:
        int currOffset;
public:
        DevIface (int initOffset);
        : : :

Does anyone know what these keywords are, and what they're meant to achieve?

Was it helpful?

Solution

This is C++/CLI.

A ref class is a managed type.
sealed means that the class cannot be inherited

OTHER TIPS

Thus summary is that "ref" and "sealed" are not standard C++ keywords. They are used in microsoft version.

sealed in C++/CLI is roughly equivalent to final in C++11.

If you are interested in the new C++/CX use of these keywords to project WinRT APIs into MS Visual C++, you may enjoy this video: http://channel9.msdn.com/events/BUILD/BUILD2011/TOOL-532T with these slides: http://video.ch9.ms/build/2011/slides/TOOL-532T_Sutter.pptx . See esp. slides 8-13. There are other talks with yet more information referenced on slide 29.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top