#include "MyOS.h"
#include "Phone.h"
#include "System.h"
int main() {
MyOS os;
Phone myPhone(os);
myPhone.start();
return 0;
}
#pragma once
#include "System.h"
class Phone {
public:
Phone(System& psystem):system(psystem){
}
void start() {
system.start();
}
private:
System& system;
};
#pragma once
#include <iostream>
#include "System.h"
class MyOS: public System {
public:
// Override
public: void start() override { //override keyword added here to make the intention clear
std::cout << "Booting MyOS..." << std::endl;
}
};
#pragma once
#include <iostream>
class System {
public:
public:
virtual void start() {
std::cout << "Booting System..." << std::endl;
}
};