"static" in C# classes is very similar to "static" in C++ classes ("static" can be used in other places in C++), with a few exceptions, for example, 1. you can initialize a static variable in C# to a constant or a class instance, but you cannot do that in C++ (VC++ 7 has modified the syntax a bit to allow initializations of constants)2. you use ClassName::StaticMemeber or a ClassInstance.StaticMember in C++ , but in C#, you can only do ClassName.StaticMember3. there is no static constructor in C++4. operator overloading often occurs as friend functions in C++, but as static functions in C#5.....

解决方案 »

  1.   

    "static" in C# classes is very similar to "static" in C++ classes ("static" can be used in other places in C++), with a few exceptions, for example, 1. you can initialize a static variable in C# to a constant or a class instance, but you cannot do that in C++ (VC++ 7 has modified the syntax a bit to allow initializations of constants)2. you use ClassName::StaticMemeber or a ClassInstance.StaticMember in C++ , but in C#, you can only do ClassName.StaticMember3. there is no static constructor in C++4. operator overloading often occurs as friend functions in C++, but as static functions in C#5.....