Commit UEA [20/06/2018]

This commit is contained in:
Pierre8rTeam
2018-06-20 15:35:55 +02:00
parent f2422666dd
commit 25b50c07ff
637 changed files with 1151 additions and 0 deletions
@@ -0,0 +1,97 @@
//+------------------------------------------------------------------+
//| ObjectsCustom.mqh |
//| Copyright 2015, Vasiliy Sokolov. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, Vasiliy Sokolov."
#property link "https://www.mql5.com"
#include "Types.mqh"
//+------------------------------------------------------------------+
//| Base Class CObjectCustom |
//+------------------------------------------------------------------+
class CObjectCustom
{
private:
int m_type;
protected:
CObjectCustom(int type){m_type=type;}
public:
CObjectCustom(){m_type=TYPE_OBJECT;}
int Type(){return m_type;}
};
//+------------------------------------------------------------------+
//| Class describing human beings. |
//+------------------------------------------------------------------+
class CHuman : public CObjectCustom
{
public:
CHuman() : CObjectCustom(TYPE_HUMAN){;}
void Run(void){printf("Human run...");}
};
//+------------------------------------------------------------------+
//| Class describing weather. |
//+------------------------------------------------------------------+
class CWeather : public CObjectCustom
{
public:
CWeather() : CObjectCustom(TYPE_WEATHER){;}
double Temp(void){return 32.0;}
};
//+------------------------------------------------------------------+
//| Class describing Expert Advisors. |
//+------------------------------------------------------------------+
class CExpert : public CObjectCustom
{
public:
CExpert() : CObjectCustom(TYPE_EXPERT){;}
};
//+------------------------------------------------------------------+
//| Class describing cars. |
//+------------------------------------------------------------------+
class CCar : public CObjectCustom
{
public:
CCar() : CObjectCustom(TYPE_CAR){;}
};
//+------------------------------------------------------------------+
//| Class describing numbers. |
//+------------------------------------------------------------------+
class CNumber : public CObjectCustom
{
public:
CNumber() : CObjectCustom(TYPE_NUMBER){;}
};
//+------------------------------------------------------------------+
//| Class describing price bars. |
//+------------------------------------------------------------------+
class CBar : public CObjectCustom
{
public:
CBar() : CObjectCustom(TYPE_BAR){;}
};
//+------------------------------------------------------------------+
//| Class describing quotations. |
//+------------------------------------------------------------------+
//class CQuotes : public CObjectCustom
// {
//public:
// CQuotes() : CObjectCustom(TYPE_QUOTES){;}
// };
//+------------------------------------------------------------------+
//| Class describing the MetaQuotes company. |
//+------------------------------------------------------------------+
class CMetaQuotes : public CObjectCustom
{
public:
CMetaQuotes() : CObjectCustom(TYPE_MQ){;}
};
//+------------------------------------------------------------------+
//| Class describing ships. |
//+------------------------------------------------------------------+
class CShip : public CObjectCustom
{
public:
CShip() : CObjectCustom(TYPE_SHIP){;}
};
//+------------------------------------------------------------------+
+43
View File
@@ -0,0 +1,43 @@
//+------------------------------------------------------------------+
//| Test.mq5 |
//| Copyright 2015, Vasiliy Sokolov. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, Vasiliy Sokolov."
#property link "https://www.mql5.com"
#property version "1.00"
#include "ObjectsCustom.mqh"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
CObjectCustom *arrayObj[3];
arrayObj[0] = new CHuman();
arrayObj[1] = new CWeather();
arrayObj[2] = new CBar();
for(int i=0; i<ArraySize(arrayObj); i++)
{
CObjectCustom *obj=arrayObj[i];
switch(obj.Type())
{
case TYPE_HUMAN:
{
CHuman *human=obj;
human.Run();
break;
}
case TYPE_WEATHER:
{
CWeather *weather=obj;
printf(DoubleToString(weather.Temp(),1));
break;
}
default:
printf("unknown type.");
}
}
}
//+------------------------------------------------------------------+
+17
View File
@@ -0,0 +1,17 @@
//+------------------------------------------------------------------+
//| Types.mqh |
//| Copyright 2015, Vasiliy Sokolov. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, Vasiliy Sokolov."
#property link "https://www.mql5.com"
#define TYPE_OBJECT 0 // General type CObjectCustom
#define TYPE_HUMAN 1 // Class CHuman
#define TYPE_WEATHER 2 // Class CWeather
#define TYPE_EXPERT 3 // Class CExpert
#define TYPE_CAR 4 // Class CCar
#define TYPE_NUMBER 5 // Class CNumber
#define TYPE_BAR 6 // Class CBar
#define TYPE_MQ 7 // Class CMetaQuotes
#define TYPE_SHIP 8 // Class CShip