skip to main
|
skip to sidebar
PROGAMMING
Monday, November 2, 2009
friend function using c++
#include"iostream.h"
class sample
{
int a;
int b;
public:
void setvalue() {a=50; b=40; }
friend float mean(sample s);
};
float mean(sample s)
{
return float(s.a+s.b)/2.0;
}
int main()
{
sample X; //object X
X.setvalue();
cout<< "Mean value="<
return 0;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
▼
2009
(44)
►
December
(1)
▼
November
(13)
PROGRAM FOR IMPLEMENTING IO STREAMS IN C++
TEMPLATES FOR CONSTRUCTORS...VECTOR PROGRAM
//virtual functions usin c++
// function overloading usin c++
// Virtual Base class
//Runtime polymorphism c++
// constructos in Derived class c++
//OverLoading Unary Minus c++
//static member function usin c++
// Objects as Arguments usin c++
friend function using c++
// OverLoading + Operator c++
Arrays of Objects usin c++
►
October
(4)
►
May
(26)
About Me
TALLAPANENI
View my complete profile
No comments:
Post a Comment