Constructor Over Load Problem
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.
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.