SHARE
TWEET

Untitled

a guest Nov 18th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Box.h"
  2. #include <string>
  3. #include <iostream>
  4. using namespace std;
  5. Box::Box()
  6. {
  7.     this->nr = licznik;
  8.     this->nrKopii = 0;
  9.     this->nazwa = "i" + to_string(nr) + "-" + "def";
  10.     cout << "K: tworze " << this->nazwa << endl;
  11.     this->a = 1;
  12.     this->b = 1;
  13.     this->c = 1;
  14.     this->liczObjetosc();
  15.     licznik++;
  16. }
  17. Box::Box(Box& b1)
  18. {
  19.     this->nr = licznik;
  20.     this->nrKopii = b1.licznikKopii + 1;
  21.     b1.licznikKopii++;
  22.     this->nazwaZrodlowegoObiektu = b1.nazwa;
  23.     this->nazwa = "i" + to_string(this->nr) + "\-" + "kopia" + to_string(this->nrKopii) + "_" + this->nazwaZrodlowegoObiektu;
  24.     cout << "KK: tworze " << this->nazwa << endl;
  25.     this->a = b1.a;
  26.     this->b = b1.b;
  27.     this->c = b1.c;
  28.     this->liczObjetosc();
  29.     licznik++;
  30. }
  31.  
  32. Box::Box(string nowaNazwa, float a, float b, float c)
  33. {
  34.     this->nr = licznik;
  35.     this->nrKopii = 0;
  36.     this->a = a;
  37.     this->b = b;
  38.     this->c = c;
  39.     this->liczObjetosc();
  40.     this->nazwa = "i" + to_string(this->nr) + "_" + nowaNazwa;
  41.     cout << "K: tworze " << this->nazwa << endl;
  42.     licznik++;
  43. }
  44.  
  45. Box::Box(string nowaNazwa, float abc)
  46. {
  47.     this->a = abc;
  48.     this->b = abc;
  49.     this->c = abc;
  50.     this->liczObjetosc();
  51.     this->nr = licznik;
  52.     this->nrKopii = 0;
  53.     this->nazwa = "i" + to_string(this->nr) + "_" + nowaNazwa;
  54.     cout << "K: tworze " << this->nazwa << endl;
  55.     licznik++;
  56. }
  57.  
  58. Box::Box(string nowaNazwa)
  59. {
  60.     this->nr = licznik;
  61.     this->nrKopii = 0;
  62.     this->a = 1;
  63.     this->b = 1;
  64.     this->c = 1;
  65.     this->liczObjetosc();
  66.     this->nazwa = "i" + to_string(this->nr) + "_" + nowaNazwa;
  67.     cout << "K: tworze " << this->nazwa << endl;
  68.     licznik++;
  69. }
  70. Box::~Box()
  71. {
  72.     licznik--;
  73. }
  74. void Box::printVolume()
  75. {
  76.     cout << "V(\"" << nazwa << "\")= " << to_string(objetosc) << endl;
  77. }
  78.  
  79. void Box::liczObjetosc()
  80. {
  81.     this->objetosc = this->a * this->b * this->c;
  82. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top