Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Example of friendly function in c++

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is a program flowchart and explain how does it help in writing a program?

1097


Can I initialize unions?

1037


Where is c used?

1092


what is a NULL Pointer? Whether it is same as an uninitialized pointer?

1271


Explain how do you declare an array that will hold more than 64kb of data?

1448


What is page thrashing?

1082


What are the 4 types of unions?

1034


Is there a way to jump out of a function or functions?

1091


What does void main return?

1118


Can a pointer be volatile in c?

981


Is c# a good language?

1009


Give differences between - new and malloc() , delete and free() ?

1096


Write a program to print “hello world” without using semicolon?

1121


What is use of pointer?

1086


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

1901