C++ static anonymous class type data member
<p>I'm trying to write C# like property, so i got this:</p>

<pre><code>#include&lt;iostream&gt;

class Timer
{
public:
    static class {
    public:
        operator int(){ return x;}
    private:
        int x;
    }y;
};
int main()
{
    std::cout &lt;&lt; Timer::y;
    std::cin.get();
}
</code></pre>

<p>and finally i got this: </p>

<pre><code>error LNK2001: unresolved external symbol 
"public: static class Timer::&lt;unnamed-type-y&gt;y&gt; Timer::y"
</code></pre>

<p>it would be appreciate if someone tell me why.</p>

<p>so its 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.</p>
