SHARE
TWEET

Untitled

a guest Feb 24th, 2020 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Product {
  2.     Postachalnik obj;
  3.     char* product;
  4.     int count;
  5.     float price;
  6. public:
  7.     Product();
  8.     Product(char*, int, float, Postachalnik&);
  9.     Product(Product&);
  10.     ~Product();
  11.     void PrintFull();
  12. };
  13. Product::Product() {
  14.     product = new char[8];
  15.     strcpy(product, "no name");
  16.     count = 0;
  17.     price = 0;
  18.     Postachalnik firma;
  19. }
  20. Product::Product(char* NameToAdd, int CounttoAdd, float PriceToAdd, Postachalnik& ObjectToAdd) {
  21.     product = new char[strlen(NameToAdd) + 1];
  22.     strcpy(product, NameToAdd);
  23.     count = CounttoAdd;
  24.     price = PriceToAdd;
  25.     obj = ObjectToAdd;
  26. }
  27. Product::Product(Product& a) {
  28.     product = new char[strlen(a.product) + 1];
  29.     count = a.count;
  30.     price = a.price;
  31.     obj = a.obj;
  32. }
  33. Product::~Product() {
  34.     delete product;
  35.     obj.~Postachalnik();
  36. }
  37. void Product::PrintFull() {
  38.     std::cout << product << '\t' << count << '\t' << price << '\t';
  39.     obj.PrintFull();
  40. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top