-
Notifications
You must be signed in to change notification settings - Fork 4
/
Task4_Polymorphism.cpp
52 lines (42 loc) · 1.2 KB
/
Task4_Polymorphism.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
43
44
45
46
47
48
49
50
51
52
/**
* @file Task4_Polynorphism.cpp
*
* @brief This code implements Polymorphism concepts.
* Land & Air Transport classes are inhereted from transport.
*
* @author Saif Ullah Ijaz
*
*/
#include <iostream>
using namespace std;
#include "AirTransportT4.h"
#include "LandTransportT4.h"
// function main begins program execution
void main()
{
char a;
char slct;
cout << "Do you want to transport your goods?<Press Y for yes & N for no> ";
cin >> a;
while (a == 'Y' || a == 'y') {
cout << "\n**************************************" << endl;
cout << "press 'L' or 'l' to use land transport service" << endl;
cout << "\nPress 'A' or 'a' to use air transport service" << endl;
cout << "*************************************" << endl;
cin >> slct;
if (slct == 'L' || slct == 'l') {
Transport* _transport = new LandTransport();
_transport->Ship();
}
else if (slct == 'A' || slct == 'a')
{
Transport* atransport = new AirTransport();
atransport->Ship();
}
cout << "\nDo you want to transport your goods?<Press Y for yes & N for no> ";
cin >> a;
}
cout << "\n\nThanks for using this program..." << endl;
system("pause");
}
// end main