What are the 'ref' and 'sealed' keywords in C++?

paxdiablo picture paxdiablo · Sep 26, 2011 · Viewed 11.5k times · Source

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?

Answer

SLaks picture SLaks · Sep 26, 2011

This is C++/CLI.

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