FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Added Friend Function Program · adarshbalu/cpp-programs@ef16779 · GitHub

Commit ef16779

Browse files
authored
Added Friend Function Program
1 parent de585b9 commit ef16779

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎friendfunction.cpp‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include<iostream.h>
2+
#include<conio.h>
3+
class abc
4+
{
5+
int a;
6+
public: abc()
7+
{
8+
a=0;
9+
}
10+
void getdata(int x)
11+
{
12+
a=x;
13+
}
14+
friend void printvalue(abc);
15+
};
16+
void printvalue(abc z)
17+
{
18+
cout<<"\nThe value is : "<<z.a;
19+
}
20+
void main()
21+
{
22+
int p;
23+
clrscr();
24+
cout<<"\nEnter the value : ";
25+
cin>>p;
26+
abc A;
27+
A.getdata(p);
28+
printvalue(A);
29+
getch();
30+
31+
clrscr();
32+
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL