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>
#include <memory>
#include <vector>
using namespace std;
class IEmployee
{
public:
virtual void getInfo() = 0;
IEmployee(string name,int id) : m_strName(name), m_intId(id) {}
protected:
string m_strName;
int m_intId;
};
class Developer : public IEmployee
{
public:
Developer(string name, int id) : IEmployee(name,id) {}
void getInfo() override { cout << "A developer ---> Name : " << m_strName << " ---> ID : " << m_intId << endl; }
};
class QA : public IEmployee
{
public:
QA(string name, int id) : IEmployee(name, id) {}
void getInfo() override { cout << "A QA ---> Name : " << m_strName << " ---> ID : " << m_intId << endl; }
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run