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

  • SEARCH
  • Home
  • 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 8704397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:05:47+00:00 2026-06-13T03:05:47+00:00

The definition of a variable in C++11 is as follows (§3/6): A variable is

  • 0

The definition of a variable in C++11 is as follows (§3/6):

A variable is introduced by the declaration of a reference other than a non-static data member or of an object. The variable’s name denotes the reference or object.

So a non-static data member reference is not a variable. Why is this distinction necessary? What’s the rationale here?

  • 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-13T03:05:48+00:00Added an answer on June 13, 2026 at 3:05 am

    Here’s one way I can declare a variable in C++:

    int scientist = 7;
    

    After this declaration (and definition, in this case), I can use scientist to read and set its value, take its address, etc. Here’s another kind of declaration:-

    class Cloud {
        public:
        static int cumulonimbus = -1;
    };
    

    This one is a bit more complicated, because I have to refer to the new variable as Cloud::cumulonimbus, but I can still read and set its value, so it’s still obviously a variable. Here’s a yet different kind of declaration:-

    class Chamber {
        public:
        int pot;
    };
    

    But after this declaration, there isn’t a variable called pot, or Chamber::pot. In fact there’s no new variable at all. I’ve declared a new class, and when I later declare an instance of that class it will have a member called pot, but right now, nothing is called that.

    A non-static data member of class doesn’t create a new variable itself, it just helps you to define the properties of the class. If it did create a new variable, you’d be able to write code like this:

    class Chamber {
        public:
        int pot;
    };
    
    void f(bool b) {
        if (b)
            Chamber::pot = 2;
    }
    

    What would that even mean? Would it find every instance of Chamber and set all their pots to 2? It’s a nonsense.

    A quick footnote: the language of the standard here is talking specifically about references, but to make the examples easier, I’ve been using non-references. I hope you can see this doesn’t change the principle of it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to display something other than the definition name in the variables
My question or rather questions are as follows: 1)Where does the static variable reside
I would like to put a large variable definition in a separate file for
As per standard Array definition: An array is a variable which allows you to
I see C books that use the same variable names in the function definition,
I'm trying to replace the value of an environment variable definition, if it exists,
I have a lot of the following warnings: Duplicate variable definition. variable 'elem' has
I need a good variable name for a boolean value that returns false when
I have a testing struct definition as follows: struct test{ int a, b, c;
I need to convert from a SQLVARCHAR to a string data type Variable definitions

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.