hawxgamer

Untitled

Dec 16th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. #ifndef CONCRETECOFFEE_CLASS_H
  2. #define CONCRETECOFFEE_CLASS_H
  3.  
  4. #include <iostream>
  5. #include "Object.h"
  6. #include "coffee.h"
  7.  
  8. class concretecoffee: public coffee, public Object
  9. {
  10. public:
  11. virtual ~concretecoffee(){};
  12. double const GetCost() const; //returns price of the specific coffee type
  13. std::string const GetDescription() const; //returns description of the specific coffee type
  14. void SetCost(double const& price);
  15. void SetDescription(std::string const& description); //uses the constant from constants header file
  16. private:
  17. concretecoffee(const concretecoffee & cconcretecoffee);
  18. concretecoffee& operator= (concretecoffee const & oconcretecoffee);
  19.  
  20. std::string mDescription;
  21. double mPrice;
  22. protected:
  23. concretecoffee(){};
  24. };
  25.  
  26. #endif
  27.  
  28.  
  29.  
  30.  
  31. _________________
  32.  
  33. #include "concretecoffee.h"
  34.  
  35. using namespace std;
  36.  
  37.  
  38. std::string const concretecoffee::GetDescription() const
  39. {
  40. return ( mDescription + " : ");
  41. }
  42.  
  43. double const concretecoffee::GetCost() const
  44. {
  45. return mPrice;
  46. }
  47.  
  48. void concretecoffee::SetCost(double const& price)
  49. {
  50. if(price<=0)
  51. throw string("Wrong price to set, the price must be greater than 0!\n");
  52. mPrice=price;
  53. }
  54.  
  55. void concretecoffee::SetDescription(std::string const& description)
  56. {
  57. if(description=="")
  58. throw string("You entered nothing for description!\n");
  59. mDescription=description;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment