Errors, bugs, questions - page 1133

 
A100:

He won't tell me.

Again: Such an object can be created within the class itself, but a pointer to such an object can also be created outside the class

So he will:

class B {
        B() {}
};
void OnStart()
{
        B *b;
        b=new B;
}
 
Fleder:

It will say so:

You can also create an object if you need to

class B {
        B( int ii ) : i( ii ) {}
        int i;
public:
        int g() { return ( i ); }
        static B *f( int ii ) { return ( new B( ii ) ); } 
};
void OnStart()
{
        B *b = B::f( 100 );
        Print( b.g());
}
 
Zeleniy:

I don't understand how to scan servers when connecting? Previously, I entered the name of the server and the list popped up, I added the necessary (picture 2, there are added servers about a fortnight ago) In picture one is no longer scanned the necessary servers, I can not add. What is no longer possible or how do you do it yourself?


You have to use part of the company name but not part of the server name. Server name search doesn't work anymore as it often gave out too big lists of matches and not at all what the trader wanted.

 
Lone_Irbis:

Yeah, and forex is best not used at all either. Or the computer, for that matter :) It's not healthy at all.

Anyway, there's already a fix. It is not very nice, but it works. The fix is called "To hell with your OOP". %) The errors were eliminated by sawing all the static variables from the classes, removing prefix static from them and stacking them neatly next to each other.

In general, I do not know why developers did not like static variables and why they had to remove automatic variable initialization feature, but if I have to, I have to. I will have to resort to workarounds...

That's how it works in C++ too. Static variables should be defined explicitly.

There are no problems with it.

 
A100:


I see your point.

If an instance of a class tries to be spawned by some external program, the constructor must be open.

If the instance "spawns itself" (and passes a pointer to itself to an external program) then a closed constructor is available.

 
Renat:

This is how it works in C++ too. Static variables must be defined explicitly.

There are no problems with it.

Well, the question is not so much where and how it works and if there will be any problems with it. The point is that it worked well before without being explicitly specified.

And in order to change something that is already working, you'd better have a much more important reason than "the neighbours do it too". :)

But come on, of course, I guess that's not the only reason.

 

The point of a single private constructor is only to limit the creation of derived classes, Alternatively, a class can have several constructors

class A {
private:
        A( int ) {}
public:
        A( int, int ) {}
};
class B : public A {
        B() : A( 0, 0 ) {}
};

 
Lone_Irbis:

It's not so much a question of where and how it works and whether it's going to be a problem. The question is that it has worked fine before without being explicitly stated.

And in order to change something that already works, it is advisable to have more important reasons than "the neighbours do it too". :)

But come on, I guess, of course, that's not the only reason.

And you try to initialize static variables in constructor's initialization list.
 
A100:

The point of the single private constructor is only to limit the creation of derived classes. A class can also have more than one constructor

After all, you are your own code developer and there is little sense in such restrictions.
 

Does everyone have the same thing going on with the MQL-Storage Fix window buttons?

There's something wrong with the buttons...

Reason: