About Classes

 

I want to make a graphical Panel using standard libraries, So I made a class for the whole panel then created an object out of it..
But I made the class on the same mq4 file.. I want to know what is more efficient, making a separate mqh file or making the class on the same mq4 file..
(resource management wise or speed wise, which method is efficient or both the same thing?)

Thanks in advance.. 

 
pipspider:

I want to know what is more efficient, making a separate mqh file or making the class on the same mq4 file.

I find that separating classes into separate files increases my programming efficiency.

As for execution efficiency, this C++ thread suggests a scenario where having code all in one file would enhance the execution speed.

https://stackoverflow.com/questions/9742934/multiple-source-file-executable-slower-than-single-source-file-executable

It's hard to say what MetaQuotes has under the hood as far as optimizations, though. My gut feeling is that there would be no added benefit in having all your code in one file for MT4.

Multiple source file executable slower than single source file executable
Multiple source file executable slower than single source file executable
  • stackoverflow.com
I had a single source file which had all the class definitions and functions. For better organization, I moved the class declarations(.h) and implementations(.cpp) into separate files. But when I compiled them, it resulted in a slower executable than the one I get from single source executable. Its around 20-30 seconds...
 
Anthony Garot:

I find that separating classes into separate files increases my programming efficiency.

As for execution efficiency, this C++ thread suggests a scenario where having code all in one file would enhance the execution speed.

https://stackoverflow.com/questions/9742934/multiple-source-file-executable-slower-than-single-source-file-executable

It's hard to say what MetaQuotes has under the hood as far as optimizations, though. My gut feeling is that there would be no added benefit in having all your code in one file for MT4.

Thanks Anthony , appreciate your time.. :)
Reason: