Example of friendly function in c++
Answers were Sorted based on User's Feedback
Answer / harry0009
#include<iostream.h>
class sample
{
int a,b;
public:
void setvalue()
{
a = 25;
b = 45;
}
friend float mean(sample s);
};
float mean(sample s)
{
return(float(s.a+& b)/20);
}
void main()
{
sample ;
x.setvalue
cout<<"mean value"<<mean(x);
getch();
}
Is This Answer Correct ? | 11 Yes | 4 No |
Which are low level languages?
Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.
7 Answers Accenture, Gridco, IBM, Kevin IT, TCS, Vimukti Technologies,
What is define directive?
what is the difference between call by value and call by reference?
5 Answers Genpact, Global Logic, Infosys,
write a program to print %d ?
program for swapping two strings by using pointers in c language
What is the value of c?
main() { int a=4,b=2; a=b<<a + b>>2; printf("%d", a); }
11 Answers HCL, Vector, Vector India, Vector Solutions, Wipro,
Explain how can you restore a redirected standard stream?
Can we change the value of constant variable in c?
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
When a c file is executed there are many files that are automatically opened what are they files?