Guest User

object.cpp

a guest
Apr 23rd, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include "object.h"
  2.  
  3. object::object(int x,int y,int k,int g)
  4. {
  5. x1=x;
  6. y1=y;
  7. kuan=k;
  8. gao=g;
  9. }
  10. object::object(object &b)
  11. {
  12. x1=b.x1;
  13. y1=b.y1;
  14. kuan=b.kuan;
  15. gao=b.gao;
  16. }
  17. object::~object()
  18. {
  19.  
  20. }
  21. void object::update()
  22. {
  23. x2=x1+kuan;
  24. y2=y1+gao;
  25. }
  26. int object::getx1()
  27. {
  28. return x1;
  29. }
  30. int object::gety1()
  31. {
  32. return y1;
  33. }
  34. int object::getx2()
  35. {
  36. return x2;
  37. }
  38. int object::gety2()
  39. {
  40. return y2;
  41. }
  42. int object::getkuan()
  43. {
  44. return kuan;
  45. }
  46. int object::getgao()
  47. {
  48. return gao;
  49. }
  50. int object::getzhen()
  51. {
  52. return zhen;
  53. }
  54. void object::setinit(int x, int y, int k, int g)
  55. {
  56. x1=x;
  57. y1=y;
  58. kuan=k;
  59. gao=g;
  60. x2=x1+kuan;
  61. y2=y1+gao;
  62. }
  63. void object::setx1(int x)
  64. {
  65. x1=x;
  66. update();
  67. }
  68. void object::sety1(int y)
  69. {
  70. y1=y;
  71. update();
  72. }
  73. void object::setzhen(int z)
  74. {
  75. zhen=z;
  76. }
  77. void object::setgao(int g)
  78. {
  79. gao=g;
  80. update();
  81. }
  82. void object::setkuan(int k)
  83. {
  84. kuan=k;
  85. update();
  86. }
Advertisement
Add Comment
Please, Sign In to add comment