Another interesting thing is how to create a hierarchy of objects or groups. For example, there are several categories, each category contains a group with n number of objects. What methods of building hierarchies does the OOP concept suggest?
An implementation of a hierarchy should provide easy transitions between its parts and levels in the loop. If we build a hierarchy inside an array, we will be left with a lot of empty space. If it is built from a complex of arrays it won't allow to freely loop through the links. What does OOP suggest?
How do you do an OOP loop on objects and their properties?
For example, I execute a loop as follows
CObj obj[]; ... for (int i=0;i<ArraySize(obj);obj[i++].CheckSomething(param));It goes something like this. And inside the class, in the CheckSomething() method, all the logic is implemented.
It goes something like this. And inside the class, in the CheckSomething() method, all the logic is implemented.
Thank you. First we assemble array obj[] from objects and then do a loop?
And what about the hierarchy? And we are talking about static hierarchy. Constant and unchangeable.
Thank you. First we assemble array obj[] from objects and then do a loop?
And what about the hierarchy? We are talking about a static hierarchy. Constant and unchangeable.
class Class1{ ... }; class Class2{ ... }; class Class3{ Class1 class1; Class2 class2; ... };
So we create a hierarchy of classes and then collect all their objects in a separate class and loop through them?
It depends on what you need, but in principle this way. You agree that it's much more elegant than your arrays. And given my strong suspicion that theirmultidimensional arrays aren't actually arrays at all, since they cannot be passed into a dll, the overhead of function calls may well be the same.
How do you loop over objects and their properties in OOP?
and through them do a loop through all links?
Use common terminology, not only can you mislead the other person with your question, but you will be sure that your question is answered
OOP Wiki - terms here.
for your information, you can make arrays of object instances (see above) or look at the sources WndContainer.mqh and ArrayObj.mqh , they are used to create graphical panels based on CPanelDialog (ready-made example in the folder ndicators\Examples\Panels\SimplePanel ), but they work with pointers and lists
It depends on what you're after, but in principle that's how it is. You agree that it's much more elegant than your arrays. And given my strong suspicion that their multidimensional arrays aren't actually arrays at all, since they cannot be passed into a dll, the overhead of function calls may well be the same.
Well, perhaps more elegantly, I won't argue. I am very concerned with practicality, expediency, simplicity and convenience, and I look at any syntax as "the enemy of the people", because it requires attention, parsing, generates errors and hinders perception. That's why I try to use as simple and even primitive code constructs as possible. The main thing is that they should be easy to read and effective.
Of course, there's a snag in the hierarchy. If we did do it in an array, loops would provide more opportunities to parse links, groups, subgroups, sub-subgroups, etc... But the memory will be used inefficiently. If we use classes, it seems to be an ideal solution. But it's for a "dead" hierarchy. For an image. But if we need to create an engine that works with it - I'm afraid that here all this syntactic hell will break loose)).
Thank you. First we assemble array obj[] from objects and then do a loop?
And what about the hierarchy? We are talking about a static hierarchy. Constant and unchangeable.
Use common terminology, you may not only confuse the other person with your question, but you will be confident that your question has been answered.
OOP Wiki - terms here.
for a given subject, you can make arrays of object instances (see the answers above) or look at the sources WndContainer.mqh and ArrayObj.mqh , they are used to create panels based on CPanelDialog (you can find a ready example in the folder ndicators\Examples\Panels\SimplePanel ), but they work with pointers and lists
In OOP "object" means a reference to a class in which its fields (properties) are declared. By "object" I mean a numbered set of properties, each of which is a cell in an array. That's the difference.
The questions are not related to the topic of graphical interfaces. I have long since bypassed graphical libraries and have nothing to look for there. But, now I'm interested in AI, which raises new challenges and questions.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How do you do an OOP loop on objects and their properties?
For example, I execute a loop as follows