Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef CONCRETECOFFEE_CLASS_H
- #define CONCRETECOFFEE_CLASS_H
- #include <iostream>
- #include "Object.h"
- #include "coffee.h"
- class concretecoffee: public coffee, public Object
- {
- public:
- virtual ~concretecoffee(){};
- double const GetCost() const; //returns price of the specific coffee type
- std::string const GetDescription() const; //returns description of the specific coffee type
- void SetCost(double const& price);
- void SetDescription(std::string const& description); //uses the constant from constants header file
- private:
- concretecoffee(const concretecoffee & cconcretecoffee);
- concretecoffee& operator= (concretecoffee const & oconcretecoffee);
- std::string mDescription;
- double mPrice;
- protected:
- concretecoffee(){};
- };
- #endif
- _________________
- #include "concretecoffee.h"
- using namespace std;
- std::string const concretecoffee::GetDescription() const
- {
- return ( mDescription + " : ");
- }
- double const concretecoffee::GetCost() const
- {
- return mPrice;
- }
- void concretecoffee::SetCost(double const& price)
- {
- if(price<=0)
- throw string("Wrong price to set, the price must be greater than 0!\n");
- mPrice=price;
- }
- void concretecoffee::SetDescription(std::string const& description)
- {
- if(description=="")
- throw string("You entered nothing for description!\n");
- mDescription=description;
- }
Advertisement
Add Comment
Please, Sign In to add comment