yuv98:
Hi,
Im trying to use constructor over load but Ive faced a problem.
Ive created this class:
when I create an object of this class and run the constructor: test2("test",1);
test is only printed one time, and the second print is empty.
do you know why?
thank you.
Because doing that you create a temporary object when calling the first constructor. mql5 doesn't allow to call a constructor from an other constructor as you want.
You can either use a default parameter :
CTest(string s,int i=0) : CTest(s)Or an private method which will be called from both constructors.
Ok,
Thanks mate.
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,
Im trying to use constructor over load but Ive faced a problem.
Ive created this class:
when I create an object of this class and run the constructor: test2("test",1);
test is only printed one time, and the second print is empty.
do you know why?
thank you.