struct vs global space

To add comments, please log in or register
Christian Stern
285
Christian Stern  

Hey all,


i am wondering if i found a bug or just misunderstood the scope of struct.


I have 2 seperate classes. One includes the other ( not extend !). In both i use a struct with the same name. Within class1 i create a object of class2.

Class2:

...

class class2 {

   private:

      struct class_struct {
         bool   full;        
      };
....   


Class1:

...
#include <class2.mqh>

class class1 {

   protected:

      struct class_struct {
         bool   full;        
      };

   public:
     void class1 () { class2 *foobar = new class2(); }
....   


When the compile is checking, he says "already used". But i declared this within the class and not in the global space. This are two different scopes but why there see each other ?


Regards, Chris

nicholi shen
1890
nicholi shen  
Christian Stern:

Hey all,


i am wondering if i found a bug or just misunderstood the scope of struct.


I have 2 seperate classes. One includes the other ( not extend !). In both i use a struct with the same name. Within class1 i create a object of class2.

Class2:


Class1:


When the compile is checking, he says "already used". But i declared this within the class and not in the global space. This are two different scopes but why there see each other ?


Regards, Chris

Mql does not obey scope when it comes to classes. There is no way to declare a private inner class. 
To add comments, please log in or register