I'm trying to write C# like property, so I got this:
#include <iostream>
class Timer
{
public:
static class {
public:
operator int(){ return x;}
private:
int x;
}y;
};
int main()
{
std::cout << Timer::y;
std::cin.get();
}
And finally I got this error:
error LNK2001: unresolved external symbol
"public: static class Timer::<unnamed-type-y>y> Timer::y"
I would be appreciate if someone tells me why.
So it's only a declaration, that's too bad, can I get some way to make it a definition other than define y somewhere else or initialize it which I just don't like and can't do it without give the anonymous type a name.