static data in ref classes and in native classes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rk

    static data in ref classes and in native classes

    According to the C++ standard, in a native class, a static member
    declaration is no definition:

    class C {
    public:
    static int c1;
    };

    Without a definition like

    int C::c1=17;

    you get a linker error.

    However, ref classes are different:

    ref class R {
    public:
    static int c1;
    };

    seems to be sufficient, without an extra definition.

    Why? I searched the C++/CLI standard and Google, but I found no
    indication that ref classes and native classes have to behave different
    with respect to static data members.

    What did I miss?

    Thanks
    Richard
Working...