Discussion of article "The Basics of Object-Oriented Programming" - page 5

 

Yes... Yes. This article is a masterpiece! Thank you so much to the author. I've had several attempts to conquer classes and still no luck. And after your article, it's like I had an epiphany. ;-)

And yet something in this article cuts my eye. Maybe I don't understand something? But please pay attention.

In the "Conclusion" section, paragraph 7"7. Virtual functions are declared by the virtualkeyword . If the descendant class has a function of the same name, it is executed; if it doesn't, the virtual function of the base class is executed."

And in the section "Some more about loading classes" there are lines like this: -"If you use an automatic pointer to the base class, the base class will be used as is. When calling its virtual functions, the code inside these functions will be executed. Virtual functions turn into regular functions."

So, I'm pointing all this out to the fact that in the "Conclusion" section in paragraph #7 you should specify that the word virtual serves to inherit derived classes when an object is declared of the base class type through a dynamic pointer. And if an object is declared of the descendant class type through an automatic pointer, then all the functions (from public and protected ) of the base class that are not of the same name are inherited with the functions of the descendant class. And in this case the word virtual has no meaning.

I attach the file "OOP_sDefaultVirtual_2.mq5", which clearly shows the work of the word virtual. Run the script with this word and without it.

And try to run your similar script "OOP_sDefaultVirtual_1.mq5" with and without the word virtual.

 

Well, are the syntax and capabilities much different in MQL4? I'm afraid to even look :)))

-

What does "alignment" mean?

Следует иметь ввиду, что в MQL4 элементы структуры следуют непосредственно друг за другом без выравнивания

 
Thanks for the article, it has helped me a lot. I am very weak in the use and understanding of CLASSES. Thank you very much, Hugs.
 
Joao Luiz Sa Marchioro:
Thanks for the article, it has helped me a lot. I am very weak in the use and understanding of CLASSES. Thank you very much, Hugs.

Look at the man tearing it up in English... hehehe

[ ]'s

 
Joscelino Celso de Oliveira:

Look at the man tearing up in English... hehehe

[ ]'s

You mean Google ripping on English. KKKKKK

 
Thanks for the article!!! A lot of people here on the forum brag about their knowledge of OOP, discuss it, but it is of no use to beginners. I am 50 years old, I studied Fortran and BASIC 30 years ago at university, and now I decided to learn MQL4 and 5 purely for myself. If possible, please continue the series of articles, you are very good at simple and accessible explanations. And more examples with comments!!!! Thank you very much again!!!
 
Thanks! great article <3 ... help me alot to better understand how MQL5 standard library really works!
 
Well written, thank you!
 

Hi, Where to NOW.  2021

There is a great resource in codebase.

I am not interested in writing code from scratch. Interesting reading and learning this 2012 article.

My interest is using MT5 wizard to combine several EA's then edit them for my strategy.

Are there articles following on from this one that will grow my knowledge.

Thanks

 
Excellent... Thank you very much....