Gholamhossein Eslamizadeh:
Hi,
I want to declare static field inside a class and access it across many instances. ( like java ) . but i see there are some practical limitaions! that I couldn't figure out!!! I know how it can be used in function but i want to use it as static field.
can you tell me how to do so. thanks in advance....
Read the documentation: Static Members of a Class
Static variables are referenced like this:
ClassName::StaticVarName
![Documentation on MQL5: Language Basics / Object-Oriented Programming / Static Members of a Class Documentation on MQL5: Language Basics / Object-Oriented Programming / Static Members of a Class](https://c.mql5.com/36/46/documentation-on-mql5-language__1.png)
Documentation on MQL5: Language Basics / Object-Oriented Programming / Static Members of a Class
- www.mql5.com
Static Members of a Class - Object-Oriented Programming - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Drazen Penic:
Read the documentation: Static Members of a Class
Static variables are referenced like this:
thank you @ Drazen PenicXD
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I want to declare static field inside a class and access it across many instances. ( like java ) . but i see there are some practical limitaions! that I couldn't figure out!!! I know how it can be used in function but i want to use it as static field.
can you tell me how to do so. thanks in advance....