I get the error C3984 when I try to compile my C++ program
When you move your class header over to a Windows Store app, you get an error might look like the following:
- error C3984: 'Aliens' : a non-value type cannot have any public data members 'appendages'
The code looks like the following, and it worked in the console app you built:
using namespace System;
ref class Aliens
{
public:
int appendages;void SetAlienName(String ^san)
{
AlienID=san;
}
String^ GetAlienID()
{
return AlienID;
}//The variable AlienID is private and requires that
// must be added to the other functions to manipulate the value of AlienID
private:
String ^AlienID;
};
What happened and why isn’t it working?
C++/CX doesn’t support public fields.
To fix: You can just make the line “int appendages; into a “trival property”. The term “Trivial Properties” are like calling the cute adorable dolphin a common dolphin, a trivial property is trivial because it is a single line of code, I guess, seems like a pretty cool way to do things.
Rewrite the “int appendages” to “property so your code will look like the following, for more examples check out the link: Properties (C++/CX)
Now your class will work in an App that is running C++/CX! This is a more secure process.