113k views
3 votes
Programmers say the data items are ____ only within the module in which they are declared.

User Rickul
by
8.4k points

1 Answer

7 votes
Data items are "local".

Consider the following example in C++.


class MyClass
{
public:
void setX(int x)
{
this->x = x;
}

private:
int x;
};


We have an integer variable local to the scope of the class declaration, and we have another integer variable local to our setX() function, though we have no global functions, that's something you want to try to avoid as a general rule of thumb.
User Yorgos Lamprakis
by
8.4k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.