-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstructor.cpp
More file actions
52 lines (49 loc) · 857 Bytes
/
constructor.cpp
File metadata and controls
52 lines (49 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
#include<iostream>
using namespace std;
class ISSC {
private:
int m;
float f;
public:
ISSC(int p ,float q ){
cout<<"Creating object "<<this <<endl;
m = p;
f = q;
cout<<"Value of m "<<m<<endl;
cout<<"Value of f "<<f<<endl;
}
ISSC(int p ){
m = p;
cout<<"Creating object "<<this <<endl;
f = 234.0;
cout<<"Value of m "<<m<<endl;
cout<<"Value of f "<<f<<endl;
}
ISSC(float q ){
m = 234;
cout<<"Creating object "<<this <<endl;
f = q;
cout<<"Value of m "<<m<<endl;
cout<<"Value of f "<<f<<endl;
}
ISSC(){
m = 3;
f = 4.0;
cout<<"Creating object "<<this<<endl;
cout<<"Value of m "<<m<<endl;
cout<<"Value of f "<<f<<endl;
}
~ISSC(){
cout<<"Object to be destroyed " <<this<<endl;
}
};
int main(){
cout<<"Sequence of Constructor and Destructor "<<endl;
int a = 12 ;
float b = 15.0;
ISSC i(a);
ISSC f(b);
ISSC g(a,b);
ISSC h;
return 0;
}