2012/6/14

C++/CX裡的partial與ref關鍵字還有hander(^)

partial ref class MainPage : public Windows::UI::Xaml::Controls::Page… {…}

 

The partial and ref keywords are obviously not ISO standard C++. They are component extensions that you use specifically for creating instances of Windows Runtime types

 

partial ref不是iso標準C++

CX

 

The ref keyword indicates that the class is a Windows Runtime reference type; using ref saves you from having to write a lot of next-generation COM code.

using ref saves you from having to write a lot of next-generation COM code. In the class member declarations, notice a Platform::Object^. The "^" symbol is known as a "hat" and it means "a handle to an object." Use it instead of "*" when you create Windows Runtime types in dynamic memory.

 

Grid^ grid = ref new Grid(); // or: auto grid = ref new Grid();
grid->Width = 600;

 

沒有留言:

張貼留言