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 |
what are the static variables
8 Answers HCL, iFlex, TCS, Wipro,
what r callback function?
What is sizeof int?
write a c programme for add of two numbers with out use of arthematic operators
WAP to find that given no is small or capital
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
write a own function to compare two strings with out using stringcomparition function?
difference between i++* and *++i
How to write c functions that modify head pointer of a linked list?
write a program to check whether a given integer is a strong number or not? [Hint: 145=1!+4!+5! =1+24+120 =145]
Can a file other than a .h file be included with #include?
34.what are bitwise shift operators? 35.what are bit fields? What is the use of bit fields in a structure declaration? 36.what is the size of an integer variable? 37.what are the files which are automatically opened when a c file is executed? 38.what is the little endian and big endian? 39.what is the use of fflush() function? 40.what is the difference between exit() and _exit() functions? 41.where does malloc() function get the memory? 42.what is the difference between malloc() and calloc() function? 43.what is the difference between postfix and prefix unary increment operators?