tags:

views:

241

answers:

3

I got stuck with a "ref" keyword which is applied to the class in .cpp file. I want to access a method which is marked as __clrcall. Can u tell me what ref keyword used for in visual c++ code?

+2  A: 

From MSDN:

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.

Link

Aamir
Still confused please elaborate
Nipun
+1  A: 

The "short short" version is that a "ref class" is a managed class. You can't have member variables of a managed type (.NET Library objects, like StringBuilder or TCPListener) in a class that is not declared "ref" -- that is, unmanaged classes cannot contain managed objects.

Coderer
A: 

"ref" keyword used on class says that this class is a managed class and c# program can access it.This class is not a normal C++ class.

Nipun