c++ code for pass object in friend function - c program with parth patthar

c program with parth patthar

learn c and c++ in better way and with simple example.

Believe on your own logic

Saturday, November 24, 2018

c++ code for pass object in friend function

//code for pass object in friend function

#include<iostream.h>
#include<conio.h>
class temp
{
int a,b;
public:
void get();
friend void check(temp);
};
void temp::get()
{
cin>>a>>b;
}
void check(temp t1)
{
cout<<"\n"<<t1.a+t1.b;
}
int main()
{
temp t1,t2;
clrscr();
t1.get();
check(t1);
getch();
return(0);
}

No comments:

Post a Comment