class FruitClass (SOLVED) - page 4

 
Alain Verleyen: More efficient ? Could you explain that please, I always thought it was just a "coding-style" without any real impact.

When the member variables are simple types (double, int, etc.) it makes little difference; construction of an uninitialized variable followed by an assignment, vs. construction of a variable with a value.

Otherwise, the class/struct is initialized with the default constructor, and then assigned. Initialization lists use a single constructor with no assignments.

 
whroeder1:

When the member variables are simple types (double, int, etc.) it makes little difference; construction of an uninitialized variable followed by an assignment, vs. construction of a variable with a value.

Otherwise, the class/struct is initialized with the default constructor, and then assigned. Initialization lists use a single constructor with no assignments.

"construction of an uninitialized variable" isn't really an operation for simple types (the memory has already been reserved on the stack/heap for the whole struct/class in advance)

Both cases just resolve to the same assignment

 
I  didnt except this thread to go on for 4 pages
 
nicholishen:

Perhaps you should start the lessons on how functions work first... 

Hello nicholishen,

I didn't make any of them into function let, I am still working on setting the parameters. I'm also not sure if these indictors will be the one's I decide to use.

 
GrumpyDuckMan:
I  didnt except this thread to go on for 4 pages
The "experts" agree so it's only 4 pages
 

Hello again,

I have decided to place all variables in global, if not dedicated to a Function / Struct / Class/ etc.....

 

Hello again.

New problem now everyone,

I can't get pass this stage of developing this code. I was going to try and modify one of the examples in MQ4 reference manual, but I am not use to using so many .mph in a program.

//+------------------------------------------------------------------+
//|                                                   Forum_Test.mq4 |
//|                        Copyright 2017, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#include <Controls\Dialog.mqh>
#include <Controls\Button.mqh>
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
class CForum_Test : public CAppDialog
  {
private:
   double            ASK,BID;
   double            Balance;
   double            Equity;
   string            Currency;

 public:

   double            StopLevel;
   double            StopLoss;
   double            TakeProfit;
   double            Risk;
   int               Orders;

                     CForum_Test(void){};
                    ~CForum_Test(void){};
  };

CForum_Test Forum_Test;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {

   if(!Forum_Test.Create(ChartID(),"Forum_Test",0,20,20,320,420))
     {
      return (INIT_FAILED);
     }
   Forum_Test.Run();

   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+

Debug:

CForum_Test{  ASK:0 BID:0 Balance:0 Equity:0 Currency:NULL StopLevel:0 StopLoss:0 TakeProfit:0 Risk:0 Orders:0 }

Reason: