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 */ }
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.
OOPS stands for object oriented programming in short . Characteristics of OOPs are : encapsulation, data hiding, polymorphism etc.
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.
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).
C is a structured programming language. PHP, COBOL is also a structured programming language. These languages follow a top down approach.
actually oop concept have some disadvantage when compared to structured 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.
Inheritance Encapsulation Polymorphism Abstraction
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 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.
C has no concept of namespaces. Namespaces are typically found in object-oriented programming languages as a means of organising code.
OOPS stands for object oriented programming in short . Characteristics of OOPs are : encapsulation, data hiding, polymorphism etc.
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 terms in the context of object oriented programming. Also explain how these concepts are implemented in C++ by giving an example program for each.
Yes. Java is an Object Oriented Programming Language and it supports the OOPS concepts like Inheritance, Polymorphism etc
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).
Beacuase Java's Concept is OOP object oriented programming and with grate feature include better then assembly lang.