Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. /*
  2. * File: Rover.cpp
  3. * Author: Jonathan
  4. *
  5. * Created on 24 October 2014, 3:19 PM
  6. */
  7.  
  8. #include "Rover.h"
  9. #include <iostream>
  10. #include <vector>
  11. #include "Device.h"
  12. #include "Battery.h"
  13.  
  14. using namespace std;
  15.  
  16. vector<Device*> devices;
  17. vector<Battery*> batteries;
  18.  
  19. Rover::Rover() {
  20. devices.clear();
  21. batteries.clear();
  22. }
  23.  
  24. Rover::Rover(const Rover& orig) {
  25. }
  26.  
  27. Rover::~Rover() {
  28. }
  29.  
  30. int Rover::deviceCount () const
  31. {
  32. return devices.size();
  33. }
  34.  
  35. void Rover:: attachDevice (Device *d)
  36. {
  37. devices.push_back(d);
  38. }
  39.  
  40. void Rover:: attachBattery (Battery *b)
  41. {
  42. batteries.push_back(b);
  43. }
  44.  
  45. /*
  46. * File: Rover.h
  47. * Author: Jonathan
  48. *
  49. * Created on 24 October 2014, 3:19 PM
  50. */
  51.  
  52. #ifndef ROVER_H
  53. #define ROVER_H
  54.  
  55. class Device;
  56. class Radar;
  57. class Battery;
  58.  
  59. class Rover {
  60. public:
  61. Rover();
  62. Rover(const Rover& orig);
  63. virtual ~Rover();
  64. int deviceCount () const;
  65. void attachDevice (Device *d);
  66. void attachBattery (Battery *b);
  67. private:
  68.  
  69. };
  70.  
  71. #endif /* ROVER_H */
  72.  
  73. /*
  74. * File: Device.h
  75. * Author: Jonathan
  76. *
  77. * Created on 24 October 2014, 6:27 PM
  78. */
  79.  
  80. #ifndef DEVICE_H
  81. #define DEVICE_H
  82. #include "Battery.h"
  83.  
  84. class Device {
  85. protected:
  86. Battery* battery;
  87. public:
  88. Device();
  89. Device(const Device& orig);
  90. virtual ~Device();
  91. virtual void draw () = 0;
  92. };
  93.  
  94. #endif /* DEVICE_H */
  95.  
  96. /*
  97. * File: Device.cpp
  98. * Author: Jonathan
  99. *
  100. * Created on 24 October 2014, 6:27 PM
  101. */
  102.  
  103. #include "Device.h"
  104. #include <iostream>
  105. #include <vector>
  106. #include "Battery.h"
  107.  
  108. using namespace std;
  109.  
  110.  
  111. Device::Device() {
  112. }
  113.  
  114. Device::Device(const Device& orig) {
  115. }
  116.  
  117. Device::~Device() {
  118. }
  119.  
  120. /*
  121. * File: Radar.h
  122. * Author: Jonathan
  123. *
  124. * Created on 24 October 2014, 3:20 PM
  125. */
  126.  
  127. #ifndef RADAR_H
  128. #define RADAR_H
  129. #include "Device.h"
  130. #include "Battery.h"
  131. #include <iostream>
  132.  
  133. using namespace std;
  134.  
  135. class Battery;
  136.  
  137. class Radar : public Device{
  138. private :
  139.  
  140. public:
  141. Radar();
  142. Radar(Battery* b);
  143. Radar(const Radar& orig);
  144. virtual ~Radar();
  145. void Operate();
  146. };
  147.  
  148. #endif /* RADAR_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement