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++.
The
^
means this is a object handle (the usual way of passing data in C#). See the wikipedia page for some brief idea.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.
精彩评论