Discussing the article: "Developing a Replay System — Market simulation (Part 16): New class system"

 

Check out the new article: Developing a Replay System — Market simulation (Part 16): New class system.

We need to organize our work better. The code is growing, and if this is not done now, then it will become impossible. Let's divide and conquer. MQL5 allows the use of classes which will assist in implementing this task, but for this we need to have some knowledge about classes. Probably the thing that confuses beginners the most is inheritance. In this article, we will look at how to use these mechanisms in a practical and simple way.

There is actually extra work related to writing the code. But as a C++/C programmer with years of experience, it's easier to understand that I am referring to a pointer when I look at code like the one shown above. And since MQL5 understands this in the same way as C++/C, I see no problems in using this notation. Whenever we see code with a notation like the one shown above, you shouldn't worry because it's just a pointer.

We can continue exploring the new class system. If you think that only these changes have happened, you are being quite optimistic. The very fact of making these changes, where we explicitly guarantee that the class will be created and destroyed at a certain time, requires making several more changes to the code. The constructor and destructor do not return values. But we must somehow know whether the class is created correctly or not.

To understand how to do this, you need to look inside the black box of the C_Replay class. It is located in the header file C_Replay.mqh. Its internal structure is shown in the image below:

Figure 01 – C_Replay.mqh

Author: Daniel Jose

Reason: