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
/*
Thanks Amine Laaboudi
for detailed explanation and effort.
https://www.sololearn.com/Discuss/3240300/why-apply-method-is-not-displaying-any-output
*/
#include <iostream>
using namespace std;
#include <memory>
class Developer;
class QA;
class ITEngg;
class INotification
{
public:
virtual void apply(shared_ptr<Developer> ptrEmployee) = 0;
virtual void apply(shared_ptr<QA> ptrEmployee) = 0;
virtual void apply(shared_ptr<ITEngg> ptrEmployee) = 0;
};
class IEmployee
{
public:
virtual void getInfo() = 0;
virtual void accept(shared_ptr<INotification> ptrNotification) = 0;
IEmployee(string name,int id) : m_strName(name), m_intId(id) {}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run