answersLogoWhite

0

Friend functions (and classes) have private access to the classes that declare them as friends. Although they have the same access rights as members of the class itself, friends are not themselves members of the class and cannot be inherited.

User Avatar

Wiki User

11y ago

What else can I help you with?

Continue Learning about Engineering

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

There is no such thing. When declaring a friend function only the explicitly-scoped friend is granted private access. The friend function may well be declared virtual within its own class but none of its overrides are granted access unless they are explicitly granted access.


What is the latent function of friends?

The only function of a friend is to extend the private class interface outwith the class, essentially making the friend part of the class interface.


Why a friend function cannot be used to overload the assignment operator?

Assignment(=) operator is a special operator that will be provided by the constructor to the class when programmer has not provided(overloaded) as member of the class.(like copy constructor). When programmer is overloading = operator using friend function, two = operations will exists: 1) compiler is providing = operator 2) programmer is providing(overloading) = operator by friend function. Then simply ambiguity will be created and compiler will gives error. Its compilation error.


Why we make a function friend in c plus plus?

A "normal" function is just a function. Even a friend function is just a normal function. However, when a class declares an external function or an external class method to be a friend of the class, the friend function gains access to the private members of the class. class foo { friend void bar(foo&); int m_data; }; void bar(foo& f) { f.m_data=42; } In the example above, the foo class declares the bar function to be a friend function. As such, the bar function has unrestricted access to the private members of foo. In this case, foo::m_data is private (by default) and would therefore be inaccessible to bar were it not declared a friend of foo. Other than that, the bar function is no different to any other function. Note that you cannot declare friendship from outside of a class. The class itself must declare its own friends. However, the same function can be declared friends in more than one class, which can be a useful feature when two or more classes work closely together, as the friend function can be used to provide the "glue" that binds them together.


Does java supports friend function?

I don't believe that Excel has such a function; you'll have to write one yourself.

Related Questions

What was a colony in which stockholders were granted rights and privileges by the English monarch?

A colony in which stockholders were granted rights and privileges by the English.


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

There is no such thing. When declaring a friend function only the explicitly-scoped friend is granted private access. The friend function may well be declared virtual within its own class but none of its overrides are granted access unless they are explicitly granted access.


What is delineation of privileges?

Delineation of privileges refers to the process by which clinical privileges are requested, recommended, and granted.


What is delineation of clinical privileges?

Delineation of privileges refers to the process by which clinical privileges are requested, recommended, and granted.


What Turkish ruler granted Christians privileges after the third crusade?

Henry


What privileges were granted to lords and vassals in a feudal relationship?

they were given land


Who is the Turkish ruler that granted christians privileges after third crusade?

Saladin


Which Turkish ruler granted Christians privileges after the third crusade?

Henrey IV


If you get your license at the age of 18 what are the restrictions?

At 18, you're legally an adult, and are granted full driving privileges.


What does privileges?

Some benefit granted to you under certain conditions. For example: "You have the privelege of staying up late, if you do your homework."


What was one way plantation owners tried to keep slaves under control?

By denying them privileges granted to indentured servants


What are privileges granted to a specific system entity such as users groups or computers which enable them to perform a task or access a resource?

permissions