Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. файл DeliveryInformation.h
  2.  
  3. #pragma once
  4. #include <iostream>
  5. #include "ProductInformation.h"
  6. using namespace std;
  7.  
  8. class DeliveryInformation: public ProductInformation
  9. {
  10. private:
  11. float charges_;
  12. string customer_;
  13. string supplyer_;
  14. public:
  15. DeliveryInformation() :ProductInformation(), charges_(0.0), customer_(""), supplyer_(""){};
  16. //~DeliveryInformation();
  17. float getCharges() const { return charges_; };
  18. string getCustomer()const { return customer_; };
  19. string getSupplyer() const { return supplyer_;};
  20. float getAmountOfProduct() const { return amountOfProduct_; };
  21. float getProductPrice() const { return productPrice_;};
  22. string getProductName() const { return productName_; };
  23.  
  24. void setCharges(float charges) { charges_ = charges;};
  25. void setCustomer(string customer) { customer_ = customer; };
  26. void setSupplyer(string supplyer) { supplyer_ = supplyer; };
  27. void setAmountOfProduct(float amountOfProduct){ amountOfProduct_ = amountOfProduct;};
  28. void setProductPrice(float productPrice) { productPrice_ = productPrice;};
  29. void setProductName(string productName) {productName_ = productName;};
  30. void createNewProduct();
  31. void deleteOneProduct();
  32. friend istream& operator >> (istream& input, DeliveryInformation& obj) {
  33. input >> obj.productName_ >> obj.amountOfProduct_ >> obj.productPrice_ >>
  34. obj.charges_ >> obj.supplyer_ >> obj.customer_;
  35. return input;
  36. };
  37. friend ostream& operator << (ostream& output, DeliveryInformation& obj) {
  38. output << obj.productName_ << "\n" << obj.amountOfProduct_ << "\n" << obj.productPrice_
  39. << "\n" << obj.charges_ << "\n" << obj.supplyer_ << "\n" << obj.customer_ << "\n";
  40. return output;
  41. };
  42. };
  43.  
  44. файл ProductInformation.h
  45.  
  46. #pragma once
  47. #include <iostream>
  48. using namespace std;
  49.  
  50. class ProductInformation
  51. {
  52. protected:
  53. float amountOfProduct_;
  54. string productName_;
  55. float productPrice_;
  56. public:
  57. ProductInformation() : amountOfProduct_(0.0),
  58. productName_(""), productPrice_(0.0) {};
  59. //~ProductInformation();
  60. virtual float getAmountOfProduct() const = 0;
  61. virtual float getProductPrice() const = 0;
  62. virtual string getProductName() const = 0;
  63. virtual void setAmountOfProduct(float) = 0;
  64. virtual void setProductPrice(float) = 0;
  65. virtual void setProductName(string) = 0;
  66. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement