开发者

VC2010 beginner question: syntax "^"

A causal VC++ user here.

I have started a 'Windows Forms Application' project in VC 2010 express. When I double clicked on a dummy button on a form, it takes me to an editor w开发者_JAVA技巧indows and jumps right into this piece of code:

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
            // do excel
         }
};

Question:

1) I wonder what does the "^" here means?

2) Why does this piece of code live in a header file (.h)


This is C++/CLI. This allow accessing .NET (CLI) object from C++.

  1. The ^ means this is a object handle (the usual way of passing data in C#). See the wikipedia page for some brief idea.

  2. Why in a .h file? In C/C++, you can put code in header file. Just putting prototype is just a matter of style. There are no syntax enforcement of this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜