Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include "my_class.hh"
  2.  
  3. int main()
  4. {
  5. My_Class my_class(NULL);
  6.  
  7. my_class.perform_tasks();
  8.  
  9. return 0;
  10. }
  11.  
  12. #include "device.hh"
  13.  
  14. class My_Class
  15. {
  16. public:
  17. My_Class(Device* device = NULL);
  18.  
  19. void perform_tasks();
  20.  
  21. private:
  22.  
  23. Device* m_device;
  24. };
  25.  
  26. #include "my_class.hh"
  27.  
  28. My_Class::My_Class(Device* device)
  29. : m_device(device)
  30. {
  31.  
  32. }
  33.  
  34. void My_Class::perform_tasks()
  35. {
  36. if(m_device != NULL)
  37. {
  38. m_device->use();
  39. }
  40.  
  41. // perform other tasks
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement