Yurttas/PL/OOL/Cplusplus/F/04/02/03/00/animals 00.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 2001
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9
10   date   : June 1, 2001.
11   author : Salih Yurttas.
12
13   animals_00.cpp
14*/
15
16
17#include <iostream>
18
19using namespace std;
20
21#include "Animal.h"
22#include "Mammals.h"
23#include "Birds.h"
24#include "Land.h"
25#include "Sea.h"
26
27int main(int argc, char* argv[]) {
28
29  Animal* a0 = new Animal;
30
31  cout << "Default construction of Animal: " << endl;
32  a0->print();
33
34  a0->set_name("A0");
35  a0->set_age(7);
36
37  cout << "After set members of an Animal: " << endl;
38  a0->print();
39
40  cout << endl;
41
42  Mammals* a1 = new Mammals;
43
44  cout << "Default construction of a Mammal: " << endl;
45  a1->print();
46
47  a1->set_name("M0");
48  a1->set_age(1);
49  a1->set_legs(4);
50
51  cout << "After set members of a Mammal: " << endl;
52  a1->print();
53
54  cout << endl;
55
56  Birds* a2 = new Birds;
57
58  cout << "Default construction of a Bird: " << endl;
59  a2->print();
60
61  a2->set_name("B0");
62  a2->set_age(2);
63  a2->set_fly(true);
64
65  cout << "After set members of a Bird: " << endl;
66  a2->print();
67
68  Land* a3 = new Land;
69
70  cout << "Default construction of a Land Mammal: " << endl;
71  a3->print();
72
73  a3->set_name("L0");
74  a3->set_age(1);
75  a3->set_legs(4);
76  a3->set_food('w');
77
78  cout << "After set members of Land Mammal: " << endl;
79  a3->print();
80
81  Sea* a4 = new Sea;
82
83  cout << "Default construction of a Sea Mammal: " << endl;
84  a4->print();
85
86  a4->set_name("S0");
87  a4->set_age(2);
88  a4->set_legs(2);
89  a4->set_lives('x');
90
91  cout << "After set members of Sea Mammal: " << endl;
92  a4->print();
93
94}