Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1. #include "Pilka.h"
  2. #include <iostream>
  3. using namespace std;
  4. Ball::Ball(double x, double y,double xSpeed,double ySpeed)
  5. {
  6.     this->x = x;
  7.     this->y = y;
  8.     this->xSpeed = xSpeed;
  9.     this->ySpeed = ySpeed;
  10. }
  11.  
  12.  
  13. double Ball::getX() const {
  14.     return x;
  15. }
  16.  
  17. double Ball::getY() const {
  18.     return y;
  19. }
  20.  
  21. void Ball::setX(double a) {
  22.     x = a;
  23. }
  24.  
  25. void Ball::setY(double b) {
  26.     y = b;
  27. }
  28.  
  29. double Ball::getXSpeed() const {
  30.     return xSpeed;
  31. }
  32.  
  33. void Ball::setXSpeed(double aSpeed) {
  34.     xSpeed = aSpeed;
  35. }
  36.  
  37. double Ball::getYSpeed() const {
  38.     return ySpeed;
  39. }
  40.  
  41. void Ball::setYSpeed(double bSpeed) {
  42.     ySpeed = bSpeed;
  43. }
  44.  
  45. void Ball::setXY(double a, double b) {
  46.     x = a;
  47.     y = b;
  48. }
  49.  
  50. void Ball::setXYSpeed(double aSpeed, double bSpeed) {
  51.     xSpeed = aSpeed;
  52.     ySpeed = bSpeed;
  53. }
  54.  
  55. void Ball::move() {
  56.     this  -> x = x + xSpeed;
  57.     this  -> y = y + ySpeed;
  58. }
  59.  
  60. void Ball::print() const {
  61.    
  62.     cout << "Ball @ (" << x << "," << y << ") z predkoscia (" << xSpeed << "," << ySpeed << ")" << endl;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement