Download MetaTrader 5

Bool access

To add comments, please log in or register
Stephen Njuki
5206
Stephen Njuki  
I have a base class that declares a number of variables chief among which are 4 bools

These bools are public

I then have two classes that inherit from this base class.

One of these classes is responsible for setting the value of these booleans which it does with no trouble.

My problem is when the other class tries to access the values of these variables once updated, they are always false.

How should I define them in the base class?
Alexey Da
Moderator
6635
Alexey Da  
At first you better attach your source code here.

Which build number do you use?
Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Client Terminal Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Client Terminal Properties - Documentation on MQL5
Stephen Njuki
5206
Stephen Njuki  
Hi

My source code is over 1k lines long... ;(

am using build 344
hasayama
626
hasayama  
ssn:
Hi

My source code is over 1k lines long... ;(

am using build 344

Are you sure that you trying to access same variables? Every child has its own inner variables:

child_1.My_public_var & child_2.My_public_var are absolutely different variables! 

teymur
3
teymur  


hi


i want to know, are you make a forex auto system by order?

best regards,Teymur M.

Alexey Da
Moderator
6635
Alexey Da  
ssn:
Hi

My source code is over 1k lines long... ;(

am using build 344
Try to shorten the code and attach it here.
Stephen Njuki
5206
Stephen Njuki  
I think I have resolved this.

The method in the subclass responsible for setting these variables was private!

Thanks for all the help any way.
To add comments, please log in or register