
1.10 | Data Structures and Algorithms Using C++
Sum=30
Subtraction=20
In Program 1.9, the method
set _ val()
declared in the private section, and methods
sum()
and
sub()
are declared in the public section. e method
sub()
is de ned outside the class that performs subtraction on
a
and
b
. e private method
set _ val()
is accessed by making a call to it in the public member function
sum()
.
1.5 CLASS SCOPE
Identi ers such as the variable name, function name,
typedef
in C++ can be used only in certain areas of
a program. is area is called the “scope” of the identi er. Scope determines the lifetime and visibility of an
identi er. It also determines ...