Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7911147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:08:40+00:00 2026-06-03T13:08:40+00:00

I have a working codebase that has a class called Tabs. All methods and

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:08:42+00:00Added an answer on June 3, 2026 at 1:08 pm

    static data members are initialized before main enters, 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.

    //globals.h
    class Globals
    {
       static int x;
    public:
       static int getX() {return x;}
    };
    
    //globals.cpp
    #include "Globals.h"
    int Globals::x = 1;
    
    //main.cpp
    #include "Globals.h"
    //x is initialized before call to main
    int main()
    {
        int x = Globals::getX();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on some Django-code that has a model like this: class Status(models.Model): code
I have checked out now a local working copy of a codebase that lives
I've been working with a codebase of a company that has a policy of
I'm working on a large codebase that doesn't have quotes around any array keys,
I have recently started working on a legacy application that has most of its
I am currently working on fixing a c# codebase which does not have a
I have working registration script the only problem is that i do not know
Have been working on this question for a couple hours and have come close
I'm working on some Clojure code that has some circular dependencies between different namespaces
In the legacy codebase that I am working on, there is a condition evaluator

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.