A base type. A ref class or ref struct can inherit from zero or more managed interfaces and zero or one ref types. A value class or value struct can only inherit from zero or more managed interfaces.

The ref key word tells the compiler that the class or structure will be allocated on the heap and a reference to it will be passed to functions or stored in class members. The value keyword tells the compiler that the all of the data in the class or structure is passed to functions or stored in members.

class_access (optional)

The accessibility of the class or struct outside the assembly. Possible values are public and private. private is the default. Nested classes or structs cannot have a class_access specifier.

inherit_access (optional)

The accessibility of base_type. The only permitted accessibility for a base type is public (public is the default).

Like their native equivalents, default member accessibility of a ref class or value class is private and default member accessibility of a ref struct or value struct is public.

A value type cannot act as a base type.

When a reference type inherits from another reference type, virtual functions in the base class must explicitly be overridden (with override) or hidden (with new (new slot in vtable)). The derived class functions must also be explicitly marked as virtual.

You can detect at compile time if a type is a CLR type with __is_ref_class (type), __is_value_class (type), or __is_simple_value_class (type). For more information, see Compiler Support for Type Traits.

In the development environment, you can get F1 help on these keywords by highlighting the keyword, (ref class, for example) and pressing F1.