Definition - What does Private mean?
Private is a keyword that specifies access level and provides programmers with some control over which variables and methods are hidden in a class. Variables and methods defined with the private keyword may be accessed only by other methods within the class and cannot be accessed by derived classes.
The private keyword is used in most object-oriented programming (OOP) languages, including C++, C# and Java.
Techopedia explains Private
The private access specifier is mostly used for encapsulation, which refers to variables or methods hidden from the outside world. This means that private variables and methods are tightly bound to a class and only available within the class scope. Private data members are usually accessed through special methods known as setters. The compiler returns an error message if a programmer attempts to access a private variable or method from outside its class.
C++ enables the use of friend functions and classes to access a private variable or method. If a class is declared a friend to another class (through adding a line of code in the latter class stating that the former class is its friend via the friend keyword), then the former class may access private variables and methods from the latter class. Additionally, if class A is a friend to class B, then B is not implicitly a friend to A. Furthermore, friendship is not transitive. For example, if A is a friend to B, and B is a friend to C, then A is not implicitly a friend to C.
Join thousands of others with our weekly newsletter
Free Whitepaper: The Path to Hybrid Cloud:
Free E-Book: Public Cloud Guide:
Free Tool: Virtual Health Monitor:
Free 30 Day Trial – Turbonomic: