I have a working codebase that has a class called Tabs. All methods and variables of this class are defined as static. I understand that a static member of class is shared by all instances of that class’s objects. This class is used to store some type of data into as sets. A lot of different files use the member functions Tabs::find() and Tabs::Insert() without ever instantiating an object of class Tabs. I’m trying to understand how this works and what this programming technique is called. Thanks.
Share
staticdata members are initialized beforemainenters, that’s why accessing them works. They reside in static memory, as opposed to dynamic or automatic.A class with only static members is similar to having global variables and functions, but grouped together. It’s not a programming technique in itself. It’s just globals.