Are native static properties allowed?

  • Thread starter Thread starter forever a loser
  • Start date Start date
F

forever a loser

Guest
If I enable "Common Language Runtime Support (/clr)" then I can:

#include <iostream>
using namespace std;

static ref struct Math
{
static property double PI
{
double get() { return 3.14; }
}
};

int main(int argc, char* argv[])
{
cout << Math::PI << endl;
return 0;
}

But I want to be able to do this natively, so I don't have to enable "Common Language Runtime Support (/clr)".

I know that native non-static properties are possible with _declspec(property(get=GetFunction,put=PutFunction)), but adding "static" keyword before and after _declspec causes my entire code not compiling at all, even when GetFunction and PutFunction are declared static.

Are native static properties possible at all?

Continue reading...
 
Back
Top