ref 关键字 VC++.NET
以前只做过MFC,从来没有接触过.NET。
最近正在学习VC.NET,可是一个ref关键字的用法让我有点迷糊。遍寻互联网,搜索到的ref关键字用法都是C#的。
例子是这样的。
private delegate double Addition();
public ref class MathOperations
{
public:
double Plus()
{
double a = 248.66, b = 50.28;
return a + b;
}
};
public public ref class CExercise : public Form
{
public:
CExercise(void)
{
MathOperations *oper = new MathOperations;
Addition *add = new Addition(oper, . . .);
InitializeComponent();
}
};