-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrip.hpp
44 lines (40 loc) · 1.51 KB
/
Trip.hpp
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
#ifndef TRIP_HPP
#define TRIP_HPP
#include <iostream>
#include "Cruise.hpp"
#include "Flight.hpp"
template<class T> class Trip;
/*template<class T> std::ostream& operator<<(std::ostream& os, const Trip<Cruise>& tripCruise);
template<class T> std::ostream& operator<<(std::ostream& os, const Trip<Flight>& tripFlight);
template<class T> std::ostream& operator<<(std::ostream& os, const Trip<Trip<Cruise>>& nestedTripCruise);
template<class T> std::ostream& operator<<(std::ostream& os, const Trip<Trip<Flight>>& nestedTripFlight);*/
template<class T>
class Trip
{
private:
T* elements;
int size;
int maxSize;
public:
int discount;
public:
Trip();
Trip(const T& object);
Trip(const T* object, int tSize);
~Trip();
void Add(const T& object);
void setDiscount(int discount);
int Size() const;
float totalCost() const;
T& operator[](int index) const;
void operator+=(const Trip<T>& trip);
friend std::ostream& operator<<(std::ostream& os, const Trip<Cruise>& tripCruise);
friend std::ostream& operator<<(std::ostream& os, const Trip<Flight>& tripFlight);
friend std::ostream& operator<<(std::ostream& os, const Trip<Trip<Cruise>>& nestedTripCruise);
friend std::ostream& operator<<(std::ostream& os, const Trip<Trip<Cruise>>& nestedTripFlight);
private:
void Allocate();
void Allocate(int tSize);
};
#include "Trip.cpp"
#endif