-
Notifications
You must be signed in to change notification settings - Fork 0
/
15_4.cpp
42 lines (38 loc) · 831 Bytes
/
15_4.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
//constructors and derived classes
#include <iostream>
using namespace std;
class mother
{
public:
mother(void)
{
cout << "mother: no parameters" << endl;
}
mother(int a)
{
cout << "mother: int parameter" << endl;
}
};
class daughter: public mother
{
public:
daughter(int a)
{
cout << "daughter: int parameter" << endl;
}
};
class son: public mother
{
public:
son(int a):mother (a)
{
cout << "son: int parameter" << endl;
}
};
int main()
{
daughter cynthia(0);
son daniel(0);
getchar();
return 0;
}