Screen class
• We can explain inline at the same time as it is declared and defined, but it is actually legal. However, it is best to explain inline only where it is defined outside the class.
Variable data members
variable data members : sometimes (but not often) it happens that we want to be able to modify a data member of a class, that is, within a const member function, and you can do this by adding the mutable keyword to the declaration of the variable.
• A mutable data member is never a const, even if it is a member of a const object.
1 class Screen2 {3 Public:4 voidSome_member ()Const;5 6 Private:7mutable size_t access_ctr;//even in a const object can be modified8 };9 Ten voidScreen::screen ()Const One { A++access_ctr;//saves a count value that records the number of times a member function is called - //other work that the member needs to complete -}
"C + + Primer The seventh chapter" "C + + Primer Seventh" Defines the data abstraction class