Errors, bugs, questions - page 1736
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
if anyone is interested, servicedesk's answer:
I am very interested! Please explain the Service Desk answer with an example.
& == GetPointer(). * - nothing has changed.
I am very interested! Please explain the Service Desk answer with an example.
& == GetPointer(). * - nothing has changed.
if anyone is interested, the answer is servicedesk:
By the way, I sent them a proposal the other day about introducing pointers to any data type. And this ridiculous restriction is already annoying.
it would be nice to introduce overloading of * operator, because without it we can't realize identity with STL, also it would be nice to introduce typedef in full, not only on calback`i
What kind of example do you want?
What you want from * and &. Something simple but illustrative. To see the convenience.
What I want I've already written above.
You may make up an example with the '&' operator yourself where you use GetPointer(...), it's essentially a short form
The example with the '*' operator - I don't know if it helps you understand:
{
int m_value;
public:
Iterator(const int val) : m_value(val) { }
int operator*() { return m_value; }
};
int main(int argc, char **argv) {
Iterator *_it = new Iterator(5);
int _val = **_it;
//---
return 0;
}
it works in C++, but in MQL you'll have to make a geter to get m_value.
Add to Help that ChartRedraw(MainChartID) is not suitable for redrawing OBJ_CHART. The ChartRedraw(ObjChartID) is required.
Therefore, the example in the Help is incorrect.
Please do not limit the scale to N <= 5 (size of area under bar = 2^N).
This is necessary (and has become expedient) to be able to look at the tick history in more detail.
{
public:
const int a;
A( int c = 0 ) : a(c) {}
virtual int f()
{
Print(__FUNCTION__);
return(this.a);
}
};
class B : public A
{
public:
const int b;
B( int c = 0 ) : A(c), b(this.f()){}
virtual int f()
{
Print(__FUNCTION__);
return(this.a);
}
};
void OnStart()
{
B b;
A* a = new B;
delete a;
}
Result
2016.10.18 09:35:01.981 Test14 (GBPUSD,M1) B::f
What is the reason for the output of B::F and not A::f? The script is written in such a way that f is called BEFORE the constructor body is executed (in bold). But at this point the A base class constructor has already been called. That's why this.f() seems to refer exactly to the base class before the B constructor is called. Please explain where the reasoning/prediction error lies.