-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtypeconversion.cpp
More file actions
55 lines (50 loc) · 857 Bytes
/
Copy pathtypeconversion.cpp
File metadata and controls
55 lines (50 loc) · 857 Bytes
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
55
//program for type conversion of farenheit type data into celcius type data...
#include <iostream>
#include <conio.h>
#include <stdio.h>
using namespace std;
class celcius;
class farenheit
{
private:
int a, b;
public:
void setData(int x)
{
a = x;
}
void showData()
{
cout << "\nCelcius type value= " << a;
}
};
class celcius
{
private:
int m, n;
public:
void setData(int x)
{
m = x;
}
void showData()
{
cout << "\nm=" << m;
}
operator farenheit()
{
farenheit temp;
temp.setData(m);
return (temp);
}
};
int main()
{
celcius c1;
farenheit f1;
c1.setData(32);
f1 = c1; // convert farenheit type data in celcius type data with the help of casting operator..
f1.showData();
getchar();
return 0;
}