C# Inheritance: Static vs. Non-Static Field

前端 未结 3 1855
粉色の甜心
粉色の甜心 2021-01-23 14:51

I have a library base class (Controller) and three sub-classes that inherit from Controller (Sensor, Output, and Enviro

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-23 15:24

    There would only be one static variable, however many subclasses you have. Is it meant to vary by subclass, or is it truly one global mapping? If it's the latter, then a static variable is appropriate. If not... well, there are various options, but you'd need to tell us what you're using the map for.

提交回复
热议问题