-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstructor.cpp
More file actions
41 lines (39 loc) · 876 Bytes
/
constructor.cpp
File metadata and controls
41 lines (39 loc) · 876 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
#include<iostream>
using namespace std;
class First
{
int i,x;
char s[];
public:
First() //Default Constructor
{
cout<<"constructor is called "<<x<<"\n\n";
}
First(int i, char s[]) //Parameterized Constructor
{
//x = i;
cout<<"i is "<<i<<"\n";
cout<<"s is "<<s<<"\n\n";
}
First(int i, int j, char s[]) //Copy Constructor
{
// x = j;
cout<<"i is "<<i<<"\n";
cout<<"j is " <<j<<"\n";
cout<<"s is "<<s<<"\n\n";
}
void Func1(int i, char s[]) //member funtion
{
cout<<"i is "<<i<<"\n";
cout<<"s is "<<s<<"\n\n";
}
};
int main()
{
char s[20];
First c1;
First c2(1,"parameterized constructor");
First c3(2,2312,"copy constructor");
c1.Func1(10,"false");
//system("pause");
}