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 7709567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:53:41+00:00 2026-06-01T00:53:41+00:00

One Book(Object Oriented Programming with C++ by E.Balagurusamy) says that const size = 10;

  • 0

One Book(Object Oriented Programming with C++ by E.Balagurusamy) says that

 const size = 10;  

means

 const int size = 10; 

but g++ compiler (version-4.6.1 in ubuntu) issues an error as

error: ‘size’ does not name a type 

what should I conclude based on this?

  1. g++ doesn’t support the feature.
  2. It is new feature. Latest g++ version supports it.
  3. The statement is wrong. Data-type is mandatory with the const keyword.
  4. Something else.
  • 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-01T00:53:43+00:00Added an answer on June 1, 2026 at 12:53 am

    Looks like an error in the book … you definitely must name a type or aliased type (i.e., a typedef) since C++ is a strongly-typed languages.

    Here is what the C++03 specification states on objects, declarations and definitions:


    Section 1.8/1:

    The properties of an object are determined when the object is created. An object can have a name (clause 3). An object has a storage duration (3.7) which influences its lifetime (3.8). An object has a type (3.9). The term object type refers to the type with which the object is created.

    Then in Section 3.1/1:

    A declaration is a definition … [note: the rest of the paragraph are exceptions to this rule and are omitted since they’re not applicable in this case]

    Then in Section 3.1/6:

    A program is ill-formed if the definition of any object gives the object an incomplete type

    Finally, in Section 3.9.2/1 it states:

    … the term object type (1.8) includes the cv-qualifiers specified when the object is created. The presence of a const specifier in a decl-specifier-seq declares an object of const-qualified object type; such object is called a const object. …


    So according to 3.9.2/1, const is a qualifier, not a type, and as-such, it has to qualify a valid unqualified type. Secondly, in the example given, according to 3.1/1, the declaration of size is also a definition, and therefore the size object must have an associated type or the program is ill-formed according to 3.1/6.

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

Sidebar

Related Questions

I am drawing one object using multi-texturing. That comes fine but when I draw
In Jesse Liberty's Learning C# book, he says "Objects of one type can be
I saw one book on C++ mentioning that navigating inheritance hierarchies using static cast
Can I use Acer Aspire One D270 net-book for programming It has got a
that approach in possible duplicate is different to the one in the book. The
History: I read from one of Knuth's algorithm book that first computers used the
My object graph contains two entities: Author and Book with one to many relationship
I am reading this one JS book that talks about inheritance and I am
I am reading one book which says Rather than setting the DialogResult by hand
I am asking myself how to design an object-oriented address book in Java. Let's

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.