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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:38:15+00:00 2026-05-16T15:38:15+00:00

What does it mean: Object’s observable state? I was reading yesterday in Exceptional C++

  • 0

What does it mean: Object’s observable state?
I was reading yesterday in “Exceptional C++” Solution to item 43 and there is a fragment:

private:
void InvalidateArea() { area
= -1; }

Even though this function modifies the object’s internal state, it should be const. Why? Because this function does not modify the object’s observable state. We are doing some caching here, but that’s an internal implementation detail and the object is logically const even if it isn’t physically const.

Corollary: The member variable area should be declared mutable. If your compiler doesn’t support mutable yet, kludge this with a const_cast of area_ and write a comment telling the next person to remove the const_cast once mutable is available—but do make the function const._

As usual thanks for answers.

  • 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-05-16T15:38:16+00:00Added an answer on May 16, 2026 at 3:38 pm

    In this context, “observable state” means whether something is, directly or indirectly, visible to users of the object.
    If using code can not, through observing the return value of any accessible member function or the value of any accessible data member, tell a difference between the object having one value of area or another, than area is not part of the object’s observable state.
    If, OTOH, using code could, for example, call a member function, and that function’s result would differ depending on the value of area, then area would be part of the object’s observable state.

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

Sidebar

Related Questions

What does object affine mean? For instance, there are object affine thread pools. While
There is such function definition: template<> template<> void object::test<1>() { } What does it
I would like to ask what does it mean AttributeError: 'unicode' object has no
I still cannot understand what does it mean to return an object in a
What does it mean to say - Engineering scalability into applications. Are there design
what does it mean where there are two id's in the jquery selector using
What does it mean when an object has two asterisks at the beginning? **variable
Command builder builds Parameter Object. What does it mean by parameter object? Why are
Does that mean that if I delete an managed object which has references (relationship)
What does it mean when a git rebase finds a conflict, but there is

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.