59 lines
1.7 KiB
C++
59 lines
1.7 KiB
C++
|
|
#ifndef EXAMPLE12_FLIGHTTICKET_H
|
|
#define EXAMPLE12_FLIGHTTICKET_H
|
|
|
|
#include <iostream>
|
|
#include <sstream>
|
|
#include "Date.h"
|
|
|
|
//C++11 has introduced enum classes (also called scoped enumerations),
|
|
//that makes enumerations both strongly typed and strongly scoped.
|
|
//Class enum doesn't allow implicit conversion to int, and also doesn't compare enumerators
|
|
//from different enumerations.
|
|
enum class FlightTicketType {
|
|
Economy = 0,
|
|
Business = 1,
|
|
FirstClass = 2
|
|
};
|
|
|
|
class FlightTicket {
|
|
protected:
|
|
double price;
|
|
std::string flightFrom;
|
|
std::string flightTo;
|
|
bool addBaggage;
|
|
FlightTicketType ticketType;
|
|
Date* ptrFlightDate;
|
|
static int numberOfFirstClass;
|
|
public:
|
|
FlightTicket();
|
|
FlightTicket(const FlightTicket& t);
|
|
FlightTicket(double price, std::string ff,std::string ft, bool bag, FlightTicketType type, Date* p_date);
|
|
virtual ~FlightTicket();
|
|
|
|
//get/set methods
|
|
double getPrice() const;
|
|
void setPrice(double price);
|
|
const std::string& getFlightFrom() const;
|
|
void setFlightFrom(const std::string& flightFrom);
|
|
const std::string& getFlightTo() const;
|
|
void setFlightTo(const std::string& flightTo);
|
|
bool isAddBaggage() const;
|
|
void setAddBaggage(bool addBaggage);
|
|
FlightTicketType getTicketType() const;
|
|
void setTicketType(FlightTicketType ticketType);
|
|
std::string getTicketTypeString() const;
|
|
Date* getFlightDate() const;
|
|
void setFlightDate(Date* flightDate);
|
|
|
|
//methods
|
|
virtual double getTotalPrice() const;
|
|
virtual std::string toString() const;
|
|
virtual bool isEqual(const FlightTicket& drugi) const;
|
|
|
|
//static method
|
|
static int GetNumberOfFirstClass();
|
|
};
|
|
|
|
#endif //EXAMPLE12_FLIGHTTICKET_H
|