Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "my_class.hh"
- int main()
- {
- My_Class my_class(NULL);
- my_class.perform_tasks();
- return 0;
- }
- #include "device.hh"
- class My_Class
- {
- public:
- My_Class(Device* device = NULL);
- void perform_tasks();
- private:
- Device* m_device;
- };
- #include "my_class.hh"
- My_Class::My_Class(Device* device)
- : m_device(device)
- {
- }
- void My_Class::perform_tasks()
- {
- if(m_device != NULL)
- {
- m_device->use();
- }
- // perform other tasks
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement