What is a friend function & its advantage?
Answers were Sorted based on User's Feedback
Answer / supriya
friend function is the one that can access the private data
members of the class to which it is made as friend. this is
advantageous when any class needs any computation which
requires the private data members of two different classes.
in such case that class can be made as friend to both the
classes whose data it needs
Is This Answer Correct ? | 27 Yes | 4 No |
Answer / devi
The above ans is also right.
->Friend function is the one that can access the private
data members of the same class and other class which it is
made as friend.
->The advantageous of friend function that function not called
by object of the class.
->That means without using object name and dot operator that call the friend function.It
can define private area and public area.
->The friend function define outside the class without using
the class name and scope resolution operator.
Is This Answer Correct ? | 16 Yes | 7 No |
What is the real life example of polymorphism?
when to use 'mutable' keyword and when to use 'const cast' in c++
String = "C++ is an object oriented programming language.An imp feature of oops is classes and objects".Write a pgm to count the repeated words from this scenario?
What is Inheritance, Multiple Inheritance, Shared and Repeatable Inheritance?
Why do we use polymorphism in oops?
Name an advantage of linked list over array?
namespace is working on which compiler?
Which language is pure oop?
I am DeePu sotware engineer working with EMC corporation ,recently I had attended mcafee interview . Their questions were at heights of stupidity , I don't know what they want , I am a developer with 4 year experienced .I am listing the questions asked 1:What is the flag in g++ to avoid structure padding 2:In wht order parameters are passed to stack 3:How you will edit code segment of an exe
Why do we use virtual functions?
Get me an image implementation program.
write a c++ code to overload + and - for a stack class such that + provides push and - provides pop operation
1 Answers College School Exams Tests, HCL, IBM, TCS,