Guest User

Untitled

a guest
Oct 20th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. oneBox(i, GARandomFloat(-1.0, 1.0) , GARandomInt(0,1), it->first , it->second) // Przykład wywołania konstruktora
  2.  
  3.  
  4. ///teraz WSZYSTKIE konstruktory dla tego obiektu
  5.  
  6. oneBox():totalMass(0){}
  7. oneBox(int i):number(i){}
  8. oneBox(int i,float f, bool b, int wk, int hk):
  9. number(i),
  10. x_k(f),
  11. rotated(b),
  12. w_k(wk),
  13. h_k(hk){
  14. totalMass = w_k * h_k;
  15. if(rotated){ //swap operation
  16. int tmp=w_k;
  17. w_k=h_k;
  18. h_k=tmp;
  19. }
  20.  
  21. }
  22.  
  23. ////////////////////////////////
  24. /// PYTANIE: dlaczego gdy i w wywołaniu konstruktora jest 0 (reszta zmiennych nie jest zerem), to zostaje wywołany konstruktor, który przypisuje wszędzie zera....
  25. //////////////////////////////
Add Comment
Please, Sign In to add comment