Friend class

Friend class

In object-oriented programming to allow access to "private" or "protected" data of a class in another class, the latter class is declared as a friend class.

Purpose

A friend class has full access to the private data members of a class without being a member of that class.

Example

A friend class can be declared as shown:class A{private: //...public: //... friend class B;}In this example class B has access to private and protected data and member functions of class A.

ee also

*friend function

References

*An introduction to object-oriented programming in c++ by Graham M. Seed

External links

http://www.cplusplus.com/doc/tutorial/


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Friend-Funktion — Unter einer Friend Funktion oder Friend Methode versteht man in der objektorientierten Programmierung eine Methode (also eine Funktion oder eine Prozedur), der man erlaubt, auf private oder geschützte Daten (private oder protected) einer anderen… …   Deutsch Wikipedia

  • Friend function — A friend function is used in object oriented programming to allow access to private or protected data in a class from outside the class. Normally a function which is not a member of a class cannot access such information; neither can an external… …   Wikipedia

  • Class (film) — Class Theatrical release poster Directed by Lewis John Carlino Produced by Martin Ransoho …   Wikipedia

  • Friend (2001 film) — Friend Theatrical poster Hangul 친구 …   Wikipedia

  • Class Action Fairness Act of 2005 — Full title An Act to amend the procedures that apply to consideration of interstate class actions to assure fairer outcomes for class members and defendants, and for other purposes. Enacted by the 109th United States Congress …   Wikipedia

  • Class A (novel) — Class A   First edition cover …   Wikipedia

  • Class of 1999 II: The Substitute — Directed by Spiro Razatos Written by Mark Sevi …   Wikipedia

  • Class (computer programming) — In object oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable …   Wikipedia

  • Class (computer science) — In object oriented programming, a class is a programming language construct that is used as a blueprint to create objects. This blueprint includes attributes and methods that the created objects all share.More technically, a class is a cohesive… …   Wikipedia

  • friend —   Hoaloha, hoaaloha, makamaka (o class); aikāne (a class); hoa pili (intimate, personal); hoa.   Also: hoalauna, makamaka hānai, aikapa, pilialo, pili mua, lawakua, lehua, hale aikāne, au ko i, pili. See saying, kou2.    ♦ My friend, ko u hoaloha …   English-Hawaiian dictionary

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”