I am studying design patterns, I was wondering if my approach makes sense.

I try to implement the strategy pattern. I think I've captured the essence of defining a family of algorithms, encapsulating everyone and making them interchangeable, as shown in the example code below.

Did I capture the intention, do I miss something from the example?

```
#include "stdafx.h"
#include
```
#include
#include
#include
Enumeration OperationType
{
Add = 1, Subtract, Multiply, Divide
};
Class operation
{
Public:
Operation (int Value1, int Value2):
m_Value1 (value1),
m_Value2 (value2) {}
virtual int Calculate () = 0;
Private:
int m_Result;
int m_Value1;
int m_Value2;
};
Class addition: public operation
{
Public:
Addition (int Value1, int Value2): operation (Value1, Value2),
m_Value1 (value1), m_Value2 (value2) {}
int Calculate ()
{
m_Result = m_Value1 + m_Value2;
return m_Result;
}
Private:
int m_Result;
int m_Value1;
int m_Value2;
};
Class subtraction: public operation
{
Public:
Subtraction (int value1, int value2): operation (value1, value2),
m_Value1 (value1), m_Value2 (value2) {}
int Calculate ()
{
m_Result = m_Value1 - m_Value2;
return m_Result;
}
Private:
int m_Result;
int m_Value1;
int m_Value2;
};
Class Multiplication: Public operation
{
Public:
Multiplication (int value1, int value2): operation (value1, value2),
m_Value1 (value1), m_Value2 (value2) {}
int Calculate ()
{
m_Result = m_Value1 * m_Value2;
return m_Result;
}
Private:
int m_Result;
int m_Value1;
int m_Value2;
};
Classification: public operation
{
Public:
Division (int Value1, int Value2): Operation (Value1, Value2),
m_Value1 (value1), m_Value2 (value2) {}
int Calculate ()
{
m_Result = m_Value1 / m_Value2;
return m_Result;
}
Private:
int m_Result;
int m_Value1;
int m_Value2;
};
Class test
{
Public:
Exam()
{
m_Operation = NULL;
}
void SetOperation (int Value1, int Value2, int Operation)
{
Switch (operation)
{
Add case:
{
m_Operation = new Addition (Value1, Value2);
}
break;
Subtract the case:
{
m_Operation = new subtraction (value1, value2);
}
break;
Multiply case:
{
m_Operation = new multiplication (value1, value2);
}
break;
Share case:
{
m_Operation = new division (value1, value2);
}
break;
}
}
int PerformOperation ()
{
return m_Operation-> Calculate ();
}
Private:
Operation * m_Operation;
};
int main ()
{
Test test;
test.SetOperation (1, 2, OperationType :: Add);
std :: cout << test.PerformOperation () << std :: endl;
test.SetOperation (2, 3, OperationType :: Subtract);
std :: cout << test.PerformOperation () << std :: endl;
test.SetOperation (3, 4, OperationType :: Multiply);
std :: cout << test.PerformOperation () << std :: endl;
test.SetOperation (40, 10, OperationType :: Divide);
std :: cout << test.PerformOperation () << std::endl;
int x;
std::cin >> x;
Return 0;
}