answersLogoWhite

0

There is no such function. Some will say friend functions undermine encapsulation however this is errant nonsense. All members of a class are automatically friends of all instances of the same class, and yet no-one ever claims this to undermine encapsulation.

To quote Bjarne Stroustrup himself:

"Friend" is an explicit mechanism for granting access, just like membership. You cannot (in a standard conforming program) grant yourself access to a class without modifying its source. For example:

class X {

int i;

public:

void m(); // grant X::m() access

friend void f(X&); // grant f(X&) access

// ...

};

void X::m() { i++; /* X::m() can access X::i */ }

void f(X& x) { x.i++; /* f(X&) can access X::i */ }

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

What is the difference between C programming and CPP programming?

C has no object oriented support. C++ is a superset of C that adds object-oriented support, but retains the concept of primitive variables. C# is a superset of C++, developed by Microsoft, that removes the concept of primitives, making it fully object-oriented but, unlike C and C++, is non-generic and is only useful for .NET programming. C# is not unlike Java, but Java is fully cross-platform and therefore has much wider support.


What is OOP concept?

OOPS stands for object oriented programming in short . Characteristics of OOPs are : encapsulation, data hiding, polymorphism etc.


Explain the following tearm in the context of object oriented programming Also explain how these concept are implement in c by given an example program for each?

Explain the following terms in the context of object oriented programming. Also explain how these concepts are implemented in C++ by giving an example program for each.


What are those languages under in object oriented programming?

Most modern programming languages have some support for object-oriented programming. In some (such as Java), it is obligatory - you have to write your code in classes. In others - such as JavaScript or PHP - it is optional, meaning that you can write programs the old-fashioned way (procedural programming).


What Example of structured programming?

C is a structured programming language. PHP, COBOL is also a structured programming language. These languages follow a top down approach.

Related Questions

What are the disadvantages of object oriented programming over structured programming?

actually oop concept have some disadvantage when compared to structured programming


What is the distinct difference between object oriented concept and object oriented programming?

Object oriented concepts are a generalisation of the object oriented principals (encapsulation, inheritance, polymorphism and abstraction) without specifying a particular implementation of those principals. Object oriented programming is the application of those principals through an object oriented programming language.


What are the basic concept of object oriented programming language?

Inheritance Encapsulation Polymorphism Abstraction


What is the difference between C programming and CPP programming?

C has no object oriented support. C++ is a superset of C that adds object-oriented support, but retains the concept of primitive variables. C# is a superset of C++, developed by Microsoft, that removes the concept of primitives, making it fully object-oriented but, unlike C and C++, is non-generic and is only useful for .NET programming. C# is not unlike Java, but Java is fully cross-platform and therefore has much wider support.


Object-oriented software is another name for structured software?

Object-oriented programming is a more recent subset of structured programming. Structured programming emphasized the need to align data structures with program structure, a concept that is formalized and carried much further in object-oriented programming. However, structured programming advocated hierarchical constraints on program structure that are incompatible with the event-driven, message-passing software architectures commonly implemented in the object-oriented style, today.


What is the namespace in c?

C has no concept of namespaces. Namespaces are typically found in object-oriented programming languages as a means of organising code.


What is OOP concept?

OOPS stands for object oriented programming in short . Characteristics of OOPs are : encapsulation, data hiding, polymorphism etc.


Is the object oriented programming in php useful?

Object orientation is not a concept related to usefull ness, it is a concept totally related to the software design. When we focused on software design we went for object orientation.


Explain the following tearm in the context of object oriented programming Also explain how these concept are implement in c by given an example program for each?

Explain the following terms in the context of object oriented programming. Also explain how these concepts are implemented in C++ by giving an example program for each.


Does java support oops concept?

Yes. Java is an Object Oriented Programming Language and it supports the OOPS concepts like Inheritance, Polymorphism etc


What are those languages under in object oriented programming?

Most modern programming languages have some support for object-oriented programming. In some (such as Java), it is obligatory - you have to write your code in classes. In others - such as JavaScript or PHP - it is optional, meaning that you can write programs the old-fashioned way (procedural programming).


Why is java language better than assembly language?

Beacuase Java's Concept is OOP object oriented programming and with grate feature include better then assembly lang.