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 |
how the compiler treats any volatile variable?Explain with example.
Derive the complexity expression for AVL tree?
What are the application of c?
Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings
write a programe to find the factorial of given number using recursion
What is a example of a variable?
how to write a program which adds two numbers without using semicolon in c
How can I find out the size of a file, prior to reading it in?
What are the different pointer models in c?
what is purpose of fflush(stdin) function
Explain how do I determine whether a character is numeric, alphabetic, and so on?
code for inverse a matrix