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

Write a program to swap two numbers without using third variable in c?

1182


What are near, far and huge pointers?

1116


What is multidimensional arrays

1176


FILE PROGRAMMING

2296


What is 02d in c?

1112


Function calling procedures? and their differences? Why should one go for Call by Reference?

1139


What are enums in c?

1289


Which is more efficient, a switch statement or an if else chain?

1082


What is the purpose of the preprocessor directive error?

1316


How can I read/write structures from/to data files?

1015


What would happen to X in this expression: X += 15; (assuming the value of X is 5)

2023


How can you increase the size of a dynamically allocated array?

1237


How can I access an I o board directly?

1130


how we can make 3d venturing graphics on outer interface

4904


Why double pointer is used in c?

1091