1
我接手一個C++ CLI項目和文件中的一個,StartScreen.xaml.h
,在Visual Studio 2013年拋出的IntelliSense錯誤下面的代碼片段:IntelliSense錯誤「公共數據成員在非值類型中不允許」是什麼意思?
public ref class StartScreen sealed
{
public:
StartScreen();
void SetApp(App^ app);
void ShowProgressRing();
void HideProgressRing();
internal:
static float imagePercentage;
....
這是最後一行是造成的問題。 imagePercentage
引發錯誤
108 IntelliSense: public data members are not allowed in non-value types
這是什麼意思,以及如何(如果有的話 - 它編譯沒有編譯器錯誤),我應該修復它?
將此成員設爲私人並添加內部獲取/設置屬性。 –
謝謝亞歷克斯。我將其改爲私人。它只用於相關的cpp文件,所以我沒有打擾內部訪問器和setter。 – dumbledad