-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtut28Simple.cpp
54 lines (49 loc) · 930 Bytes
/
tut28Simple.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include<iostream>
using namespace std;
void name(){
cout<<'Author: Varun Gupta'<<endl;
}
class Modern;
class Classic
{
int a;
public:
friend int add(Classic , Modern);
Classic()
{
cout<<"Enter the first number :"<<endl;
cin>>a;
}
void outdata()
{
cout<<"The number is :"<<a<<endl;
}
};
class Modern
{
int b;
public:
friend int add(Classic , Modern );
Modern()
{
cout<<"Enter the second number :"<<endl;
cin>>b;
}
void outdata1()
{
cout<<"The second number :"<<b<<endl;
}
};
int add(Classic x1, Modern x2)
{
return x1.a+x2.b;
}
int main(){
name();
Classic c1;
c1.outdata();
Modern m1;
m1.outdata1();
cout<<"The sum of the entered values is :"<<add(c1,m1)<<endl;
return 0;
}