What is the difference between a static variable in C++ vs. C#?

后端 未结 3 1394
再見小時候
再見小時候 2021-01-17 23:24

Do static variables have the same or similar functionality in C# as they do in C++?

Edit:

With C++ you can use static variables in many different contexts -

3条回答
  •  一生所求
    2021-01-17 23:44

    A static variable in C# behaves like a static member variable in c++. That is out of the multiple meanings of the 'static' keyword in c++ only one of Them exists in the context of C#. E.g. you can't limit the scope to a file with static (which is strictly a C feature) in C#

提交回复
热议问题