How to implement a class member which is a instance of the class I define: Get "wrong parameters count"
I recommend you what I wrote here: https://www.mql5.com/en/forum/376954#comment_24432264
It's a lot faster than waiting here for an answer.
- 2021.09.04
- www.mql5.com
Thanks. That's a solution.
I prefer to use initializer list so I wrote this way.
If I removed the A() and just leave a() empty, that seems fix the problem in my preferred way.
I don't need to call a constructor in the initializer list. All it needs is params of the constructor.
public:
B(): a() {};
My question is now clearer.
How to use member initializer list correctly.
I recommend you what I wrote here: https://www.mql5.com/en/forum/376954#comment_24432264
It's a lot faster than waiting here for an answer.
You are right. There is an answer in the link.
https://www.mql5.com/en/docs/basis/types/classes#initialization_list
Thanks!
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi community,
I'm trying to have a class member which is a instance of the class I define.
(In this code, trying to have a member "A a" in the class "B")
When I compile it, result is:
'A' - wrong parameters count
at second to the last line.
Q1. Is it possible to achieve what I'm trying here?
if (Q1 == true)
Q2. How should I implement?
else
Q3. Any workaround you suggest?
Thanks.