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 generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

3489


How can I do serial ("comm") port I/O?

1152


What are the advantages and disadvantages of c language?

980


What are qualifiers in c?

999


What are the modifiers available in c programming language?

1186


Is fortran still used today?

1061


What is include directive in c?

1116


the question is that what you have been doing all these periods (one year gap)

2042


How do you sort filenames in a directory?

1135


Can include files be nested?

1078


How do you generate random numbers in C?

1164


What is define directive?

1100


What are c header files?

966


Is c# a good language?

983


What are valid operations on pointers?

1164