Questions on OOP in MQL5 - page 75

 

the question is off, I just can't read the signature of the function

void deleteCTest(CTest * &t)

I can't read it.

The logic says I should write something like this:

void deleteCTest((CTest *) &t)

pass by reference a pointer to a type, but the compiler gives errors with such brackets, but at least now I understand what at least the function received as arguments ))

 
Igor Makanu:

the question is off, I just can't read the signature of the function

I can't read the signature.

I should logically write something like this:

pass by reference a pointer to a type, but the compiler generates errors with such parentheses, but at least now I understand what at least the function received as arguments ))

Wouldn't it be easier just to use & ...

For me & is a strict reference

* - is a designation of a variable where we will write the address of a reference and further we will work with this variable, therefore it is possible to change the class while getting it, which sometimes confuses the situation.

the * & operator is rarely needed

 
Alexandr Andreev:

the * & operator is rarely needed

no doubt

But I'm writing it, I just decided to understand what we pass and what we get when working with pointers in MQL .... withGetPointer()

;)

 

For me it is more interesting to write Red sorting by classes, or a tree of deliberate sorting, something like a list, but with built-in binary search on the list itself, and sorting of this list (in general, I am weak in this terminology, maybe it already exists, just called something (someone's colour tree))

At the same time and understand everything at once
 
Igor Makanu:

the question is off, I just can't read the signature of the function

I can't read it.

The logic says I should write something like this:

void deleteCTest((CTest *) &t)

pass by reference a pointer to a type, but the compiler generates errors with such brackets, but at least now I've figured out what at least the function received as arguments ))

Just in case - the notation "ghost" is irrelevant in function definition, only when called. And if you pass & to a function which waits for *, then the conversion isn't needed.

And thinking aloud - I think whether such a necessity exists at all, pass an object pointer by reference and nail/reincarnate it in a third-party function.

I think it doesn't fit in with purpose of dynamic objects.

Alexandr Andreev:

For me it's more interesting to write Red sorting by classes, or a tree of deliberate sorting, something like a list, but with built-in binary search on the list itself, and sorting of the list (in general, I'm weak in this terminology, maybe it already exists, it's just called somehow (the tree someone colour))

It will also give you an insight into what's going on

Have you looked at the standard library for this? Every programmer should write some sorting from scratch :)

 
Методы сортировки и их визуализация с помощью MQL5
Методы сортировки и их визуализация с помощью MQL5
  • www.mql5.com
В Сети можно найти ряд видеороликов с демонстрацией различных видов сортировок. Например, здесь представлена визуализация 24 алгоритмов сортировки. Это видео я и взял за основу, наряду со списком алгоритмов сортировки. Для работы с графиками в MQL5 разработана специальная библиотека Graphic.mqh. Она уже описана в статьях: в частности, здесь...
 
Igor Makanu:

no arguments

But I'm writing it, I just decided to understand what we pass and what we get when working with pointers in MQL .... with GetPointer()

;)

However, it's interesting, you've been here for many years and I remember you from discussions of OOP for a long time, and now it turns out that you don't even have a clue how it's implemented in MQL. The question is, why have you been using MQL forum all this time?)

May be you don't use dynamic objects, although I can hardly imagine how one can do without them in OOP, especially since all standard MQ-libraries are adapted to pointers only.

And the goal isn't very clear either. Why would you want to study MQL if you own C#? To artificially condemn yourself to hardships... Do you know that .Net libraries are easily pick up in MetaEditor? Although only static methods are available and data types are limited. But for organizing communication and data transfer is enough. Although I haven't checked it, maybe the integration is already deeper. I have to look at it.

 
Igor Makanu:

Do you think that more than half of the forum participants understand how OOP in MQL works? - I doubt it, at least the messages of even the old-timers and active participants show their level of knowledge of MQL

And this is why the OOP is mostly used to use SB,

I don't even know how people bother using it in their robots - it's just showing off. Structures at most.

Semka went away with his drawing, who needs this drawing, here they came to earn money for themselves and their loved ones, of course the developers didn't feel sorry for him. Peter, anything but trade). Fill programmers' brains with unnecessary functionality

 
awsomdino:

Classes, inheritance, virtualisation, templates, it was very difficult for me to understand this as a self-taught person, I understood a little and abandoned OOP, I can't even imagine how people bother in their robots - that you have to use all this, it's just a show-off. structures at most

depend on the task, although I agree in general - the goal is not the art of writing the right code in accordance with current programming trends, but the opportunity to make money

I have learned how to draw beautiful pictures in the tester, that can pass the test on the history and forward, now I'm collecting information how to combine the online trading and the tester itself, here I most likely need OOP - I want to add and delete strategies in real time, save and plan to be able to move from PC to PC in real time - not much information on the status of the TS, but the usual way - to write everything into the magic number will not work

in general while analyzing the material

awsomdino:

Semka gone with his drawing, who needs this drawing, here came the money to make themselves and their loved ones, of course he was not sorry for the developers. Peter, anything but trade). Filled programmers' brains with their unnecessary functionality

Well creativity is interesting, and the warm-up for the mind is always needed, I'm a few years I did not sit at a PC - all completely weathered, then, in fact, from scratch stuff to raise, so do not take all the creativity of programmers as their desire to achieve something - just creativity and a warm-up, imho, although there are exceptions - see sense in it ;)

 
Igor Makanu:

it depends on the task, although in general I agree - the goal is not some art of writing the right code according to modern programming trends, but an opportunity to make money


The example should be taken from Saber, I don't know the true purpose of it, but I saw his if else) tree there to get what you need. I had a question when I came here, how to do it right away, and look for how to implement it, re-read everything - really lost only time, there is no correct implementation, heaps of articles and everywhere his own. I'm really disappointed when you don't understand much here in the code and stand at the crossroads of 5 roads and think which way to go. It's not even a question of whether you'll find a profitable trading system here, the question is whether you'll find the right optimal way here) - This is our dear MQL5.