[WEBINAR] Bulletproof: How Today's Business Leaders Stay on Top


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.

Share this:

Connect with us

Email Newsletter

Join thousands of others with our weekly newsletter

The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.