What is friend class?

View previous topic View next topic Go down

What is friend class?

Post  skyboard on Sat Sep 17, 2011 10:04 pm

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.

Example

//A friend class can be declared as:
class A
{
private:
//...(statements)
public:
//...(statements)
friend class B;
}

skyboard

Posts : 31
Join date : 2011-09-03

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum