CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
using namespace std;
#include <memory>
class IEmployee;
class INotification
{
public:
virtual void apply(shared_ptr<IEmployee> ptrEmployee) {};
};
class IEmployee
{
public:
virtual void getInfo() = 0;
virtual void apply(shared_ptr<INotification>& ptrNotification) = 0;
IEmployee(string name,int id) : m_strName(name), m_intId(id) {}
protected:
string m_strName;
int m_intId;
};
class Developer : public IEmployee, public enable_shared_from_this<Developer>
{
public:
Developer(string name, int id) : IEmployee(name,id) {}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run