answersLogoWhite

0

We use these keywords to specify access levels for member variables, or for member functions (methods). Public variables, are variables that are visible to all classes. Private variables, are variables that are visible only to the class to which they belong. Protected variables, are variables that are visible only to the class to which they belong, and any subclasses.

Deciding when to use private, protected, or public variables is sometimes tricky. You need to think whether or not an external object (or program), actually needs direct access to the information. If you do want other objects to access internal data, but wish to control it, you would make it either private or protected, but provide functions which can manipulate the data in a controlled way

User Avatar

Wiki User

∙ 18y ago
User Avatar

What else can I help you with?

Related Questions

What is friendly in c plus plus?

The keyword "friend" allows a function or variable to have access to a protected member inside a class.


What is the difference between constructor and friend function in c plus plus?

A constructor is a method that fires when the object is instantiated. A friend function is a function that has special access to the object. They are two different types of things, and cannot be further differenced.


What is the difference between private stafford and plus student loans?

What is the difference between private stafford and plus student loans?


What is the difference between pointers in c and c plus plus?

Nothing.


What is the difference between be plus ing and get plus ing?

There are no such terms in C++.


What is the difference between statements in c plus plus charconstp and char constp?

There is no difference. Both statements are invalid.


What is the difference between plus 8 and -12?

-4


Difference between void and devoid in c plus plus?

There is no such thing as devoid in C++.


What is the difference between DVD plus r and DVD plus rw?

rightable and rewightable


What is difference in photo paper plus glossy and photo paper glossy?

There is no difference between photo paper glossy and plus glossy. The main difference in photo paper can be seen between a matte finish and glossy finish.


What is the difference between Matiz Se and Se plus and that about the safety?

se has not got electric windows like the se plus,otherwise no difference.


What is difference between plus plus you and you plus plus?

Both ++you and you++ have the same ending result. The variable you is incremented. The difference is that, if you use the combination in a larger expression, then you++ will have the initial value of you, while ++you has the incremented value of you.