Hi, I have the problem that when an object of the child class is created, the constructor of the parent class is called without notice.
Output:
🤔
Practically not possible. What you can do is this:
class A { A() = delete; }; class B : public A { B() {}; };
Or this:
class A { }; class B : public A { B() {}; };
But why???
EDIT:
Try to compile it and see what happens....
nah, because the classB has other tasks than classA ...
Ok, i changed the structure little bit the stuff works as I need it - but strange. C++ and other languages are different.
Thank you!
Hi, I have the problem that when an object of the child class is created, the constructor of the parent class is called without notice.
Output:
🤔
What a bad idea !
The constructor of A NEEDS to be called.
C++ is similar to MQL in that regards.
Even if C++ allow to somehow to not call the base constructor (as far as I know it's done implicitly if not explicitly), it's really a strange requirement. I can't imagine something else that a bad design.
- 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, I have the problem that when an object of the child class is created, the constructor of the parent class is called without notice.
Output:
🤔