Discussion of article "The Basics of Object-Oriented Programming"

 

New article The Basics of Object-Oriented Programming is published:

You don't need to know what are polymorphism, encapsulation, etc. all about in to use object-oriented programming (OOP)... you may simply use these features. This article covers the basics of OOP with hands-on examples.

Figure 5. Accessing Functions by Class Users

Author: Дмитрий

 

Why are the codes not run through the styler?

It will be difficult for a newcomer to read, he sees one style in ME and another in the article.

ZY The article doesn't reveal the issues of class connection.

In general, of course, OOP is a complex topic, it is not easy to describe it in simple language, but you have to start somewhere.

 

I liked the article, thanks to the author.

But the code is unreadable - I agree with the previous speaker.

 
Urain:

1. Why are the codes not run through the styler?

It will be problematic for a beginner to read, in ME he sees one style and in the article another.

2. ZY The article doesn't reveal the issues of class communication.

In general, of course, OOP is a complex topic, it is not easy to describe it in simple language, but you have to start somewhere.


1. puzzled. It seems that I ran it. Definitely ran!

Here it is:

~CName(){ Alert("Destructor "+IntegerToString(m_arg)); }
void Sleep()  { Sleep(3000); }

Not my style at all (one line curly braces).

2. Clarify, it is not clear, what is the connection?

 

Apparently the question is more for the developers.

Quote:The difference is that data structures can only include variables.

In C++, a structure is defined as a class, all members of which are open.

In the current version of MQL5 - 555 you can also use a member-method in a structure.

Is this an omission of the current build and is it planned to allow the use of only data members in the future?

 
Integer:
...

2. Clarify, it is not clear what the association is?

Association and other ways of linking classes.

 
Urain:

Association and other ways of linking classes.

I don't get it."Using OOP to change the logic of a programme" isn't it?

Or wrapping several classes into one class? - There is something about it, that you can declare pointers to other classes in a class.

 
Dima_S:

Apparently the question is more for the developers.

Quote:The difference is that data structures can only include variables.

In C++, a structure is defined as a class, all members of which are open.

In the current version of MQL5 - 555 you can also use a member-method in a structure.

Is this an omission of the current build and is it planned to allow the use of only data members in the future?


Can functions be written in a structure? Probably pointers to the class - seen, tried, it is better not to know about it.
 
Integer:
You can write functions in a structure?
You can.
 
Dima_S:

Apparently the question is more for the developers.

Quote:The difference is that data structures can only include variables.

In C++, a structure is defined as a class, all members of which are open.

In the current version of MQL5 - 555 you can also use a member-method in a structure.

Is this an omission of the current build and is it planned to allow the use of only data members in the future?


Open the help on structures. and also read the type conversion, about structures.

Method members were available from the very beginning. Why do you want to remove them?

 
Integer:

1) I don't get it. "Using OOP to change the logic of a programme" isn't it?

2) Or wrapping several classes into one class? - There is something about it, that you can declare pointers to other classes in a class.

1 No, it's not, it's the use of inheritance.

2 is warmer, it's Composition, which is one of the three binding options, along with Association and Aggregation.

By the way, I am surprised that such fundamental paradigms are not covered in the description of OOP in the help.