Advertisement
irmantas_radavicius

Untitled

Mar 16th, 2022
737
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #ifndef ALL_H
  2. #define ALL_H
  3.  
  4. #include <string>
  5. #include <iostream>
  6.  
  7. #define string std::string
  8.  
  9.  
  10. namespace Sandbox {
  11.    
  12.    
  13.     class NameMismatchException {
  14.     };
  15.    
  16.     class Item {
  17.             class Implementation;
  18.             Implementation *impl;
  19.         public:
  20.             Item(const string &name, const double price);
  21.             Item(const Item &other);
  22.             Item& operator=(const Item &other);
  23.             ~Item();                   
  24.             unsigned int getId() const;
  25.             string getName() const;
  26.             void setName(const string &name);          
  27.             double getPrice() const;
  28.             void setPrice(const double price);         
  29.             Item& operator++();        
  30.             Item operator++(int);          
  31.             string operator=(const string &name);  
  32.             Item operator+(const Item &i2);            
  33.             void operator+=(const double change);
  34.             void operator-=(const double change);                      
  35.             static unsigned int getAliveCount();           
  36.             string toString() const;
  37.             friend std::ostream& operator<<(std::ostream& o, const Item &item);
  38.             friend std::istream& operator>>(std::istream& i, Item &item);
  39.     }; 
  40.    
  41.    
  42. }
  43.  
  44. #undef string
  45.  
  46. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement