You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
You are either obtuse or obtuse, sorry to be blunt, written in black and white:
Noooo... You're the slowpoke!
Why? Because you can't read.
And now I'll quote:
It says that preserving OOP principles and not creating global variables, we can count the number of some words with a static class member,
it(static class member)is created as a single instance and doesn't depend on how many objects of the class are created.
I need the same thing, only from a structure. Or is it hard to understand? How many times was the question raised about how the structure differs from the class, and how many times was the answer that it is almost nothing. There are not so many differences. At least, at least in C++ it is so. I asked this question once on one forum where there are a lot of professionals. Why there is such a difference here is a question.
I said from the beginning that I needed these variables in a single instance. Or is it hard to read?
Let me repeat what I need. There's a structure, the members of which must store their values at runtime, but when any method of any class that uses this structure is accessed, the members can be modified. I understand they need to be static. These members should be in a single instance. The members of this structure will be used by many classes and by the Expert Advisor itself as well.
Regarding the documentation of class distinction and structure read. Again for the "smart guy"ALXIMIKS here:
Classes have a number of differences from structures:
Is there anything about static?
Victor, that's something! :-(
You've already been told how and what to do several times.
Why don't you start to get into it?
Opens the documentation here and sees that:
If class or structure variables don't lose their values at runtime, why are they declared as static here ?
They are in the public section, you can say that as in structure...
back to your rams.
What do you want?
what do you want?
Reading the manus:
Not being able to declare class members statically would result in the need to declare theseat the global programlevel.
We're talking about classes and structures. Judging from what I wrote above, according to the documentation there is a difference between a class and a structure, but clearly it's not about whether you can or cannot use the static modifier.
Is there such a thing? Yes, there is!
Going further:
This would sever the relationship between the data and its class, and is also inconsistent with the basic OOP paradigm of combining data and methods in a class to handle it. A static member allows class data, which is not specific to an individual instance, to exist in the scope of the class.
Since a static class member is instance-independent, the reference to it is as follows
Here's what I need to do. my structure members were instance-independent.
I did this by analogy with classes. You see?
I need that the my structure members were not dependent on an instance of the structure.
struct A
{
int v;
};
static A a;
?
why do something? create one global class object and that's it. (oy-yo-yo-yo - structures, then you will understand something of your own again and attack)
Pros:
1) less text
2) more portability
3) if you suddenly need another object, there are no bans on its creation
4) possibly a large amount of data, but this is a question for the developers.
Cons:
1) I don't like referring to fields via object name, I want it via static, understand me all.
struct A
{
int v;
};
static A a;
?