Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ffc649b

Browse files
Classes with friend function
0 parents commit ffc649b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

‎class.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include<stdio.h>
2+
class employee
3+
{
4+
int emp_id;
5+
string emp_name[20];
6+
public:
7+
void read(int a,string n)
8+
{
9+
emp_id=a;
10+
emp_name=n;
11+
}
12+
friend void show(employee E);
13+
};
14+
void show(employee E)
15+
{
16+
cout<<"Name of the employee is "<<emp_name<<endl<<"ID of the employee is "<<emp_id;
17+
}
18+
int main()
19+
{
20+
employee E;
21+
E.read(23402,"Nishkarsh Raj Khare");
22+
show(E);
23+
return 0;
24+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /