Talking about the PLO in the lounge - page 8

 
Maxim Dmitrievsky:

Probably because I hardly understand this code :)

Sorry, I'm an amateur programmer... I'm only familiar with OOP at a basic level

Well, you're not the only one who doesn't understand it, you're not the only one... This style - to cram what cannot be crammed into a macro - has its advantages and disadvantages. As far as I noticed, my colleaguefxsaber shows only advantages (flexibility, cross-platform, etc.). And the fact that you can't check such code in Debugger, what's it like? Well, readability of such style is rather questionable. But, as they say, the master is the master...

 
Комбинатор:
In C++, class and structure are the same, just some defaults are different.

yep, how do you take a pointer to a structure?

 
Vasiliy Sokolov:

So you have to learn from the right examples. And there are none in SB. Take CObject for example - it doesn't provide type control, it doesn't provide interface-level work with objects, but it contains meaningless methods like Save() and Load(), which are never redefined in practice. The m_prev and m_next pointers are used in a single CList class, but are present as ballast for all its descendant classes. The most useful is the Comparer() method. It is actually overridden most often. But in the normal way Comparer() is an interface, it would be better to define it not in a CObject, but as a separate class.

Please explain about the control, I don't understand. What kind of objects? In general, this should be a dummy class with no fields or methods. Its sole purpose is to provide a common ancestor for other classes. It's a big mistake that the developers have stuffed it with rubbish.

There should not be any Compare there. It should be a dummy class.

 
Alexey Volchanskiy:

Explain about control, I don't understand. With what objects? It should be a dummy class with no fields or methods. Its only purpose is to provide a common ancestor for other classes. It's a big mistake that the developers have stuffed it with rubbish.

There should not be any Compare there. It should be a dummy class.

This isn't SmallTalk, all the practice (and theory as well) has shown that outputting an object tree from Adam is a mean evil. And ST is allowed to do that, he's in his own juice (his own virtual machine).

judging by the heat, expect a try-catch-throw by March 8 ? :-) It will be a woman's festival of course, but it will be a sin not to drink.

 
Maxim Kuznetsov:

This is not SmallTalk, all practice (and theory, too) has shown that deriving the object tree from Adam is a cruel evil. And ST is allowed to do this, he's in his own juice (his virtual machine).

I think we may expect try-catch-throw by March 8? :-) Of course it will be women's day but it will be a sin not to drink.


No, there will be no holiday, Renat said - no exceptions. Seehttps://www.mql5.com/ru/forum/168361 , someone brought it up. I wondered myself whether there are plans for the exeptses or what? The answer was alas no.

But in the compiler we've got an important checkbox - check divisors ))))). Waiting for "check array bounds..." checkbox by March 8. And then we'll see another 25 pages with similar checkboxes. We don't know how to make an excerpt, do we?

SZY: Looked at base class Object in C#, also minimum. Picture from msdn


Почему в MQL5 нет исключений?
Почему в MQL5 нет исключений?
  • 2017.01.29
  • www.mql5.com
Не нужны, надо все условия руками проверять, по старинке оно надежнее Нужны, почему нет - не знаю А что это такое? Хочу посмотреть...
 
Dennis Kirichenko:

Well, you're not the only one who doesn't understand, you're not the only one... This style - to cram what you can't cram into Macros - has its advantages and disadvantages. As far as I noticed, my colleaguefxsaber demonstrates only advantages (flexibility, cross-platform, etc.). And the fact that you can't check such code in the debugger, what's that? Well, readability of such style is rather questionable. But as they say, the master is the boss.

Why attribute to a concrete example what it doesn't contain?

Maxim Dmitrievsky:

What models can be used to learn how to program in exactly the same way? :) looks very nice.

I'm self-taught, that's why I don't follow it anywhere. I have a Tupolev approach: "Only beautiful planes fly well!"

 
Maxim Kuznetsov:

This is not SmallTalk, all practice (and theory, too) has shown that deriving the object tree from Adam is a cruel evil. And ST is allowed to do that, he's in his own juice (his own virtual machine).

Judging by the heat, we're expecting try-catch-throw by March 8 ? :-) Of course, it's going to be a woman's holiday, but it's a sin not to have a drink.


The point of an empty base class is that we can write such a thing. I'll say right off the bat, the example is not useful, I made it up on the fly. The point is that we can reduce any derived class to CObject*.

CObject* objarr[12];

void OnStart()
{
    objarr[0] = new CAccountInfo;
    // еще что-то подобное, кладем в массив указатели на объекты абсолютно разных классов, но с одним предков
    objarr[11] = new CDealInfo;
    // обращаемся и работаем
    CAccountInfo * ai = (CAccountInfo*)objarr[0];
    //
    
    for(int n = 0; n < 12; n++)
        if(CheckPointer(objarr[n]) == POINTER_DYNAMIC)
            delete objarr[n];
       
}

*

 
Alexey Volchanskiy:

yep, how do you take a pointer to a structure?

I honestly don't understand the question, but in any case it's the same as for the class
 
Комбинатор:
I honestly don't understand the question, but in any case it's the same as for the class

I'm very sorry, in the context of which language are you drawing this conclusion? :-)



 
Комбинатор:
I honestly don't understand the question, but either way it's the same as for the class

class C {};
struct S {};

void OnStart()
{
    C *_c = new C; // так можно
    S *_s = new S; // указатели на структуру не допускаются 
}