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
A question has arisen:
There is a "Program" class which uses the"New Bar" and "Data Manager" classes. The "New Bar" class in turn also uses the "Data Manager" class. Public getters and setters are implemented in the "Data Manager" class.
Question: What are the options for the initialization of the program for the "New Bar" class to specify the "symbol" and "timeframe" properties of the "Data Manager" class? I would not like to have public getters and setters in the New Bar class to access the data manager fields. And we'd like to keep the data manager private.
In other words: The application can use multiple classes that use the data manager. During initialization of the program, all manager fields of all classes must be initialized with required values. But I don't want to create getters in all classes to access the data manager fields. So...
According to your description it makes sense to separate these settings into a separate entity, the same for all managers and not only
Yes, it looks like you need to inherit classes that need a manager from a base class that has getters to the manager fields. Thank you.
A question has arisen:
There is a "Program" class which uses the"New Bar" and "Data Manager" classes. The "New Bar" class in turn also uses the "Data Manager" class. Public getters and setters are implemented in the "Data Manager" class.
Question: What are the options for the initialization of the program for the "New Bar" class to specify the "symbol" and "timeframe" properties of the "Data Manager" class? I would not like to have public getters and setters in the New Bar class to access the data manager fields. And we'd like to keep the data manager private.
In other words: The application can use multiple classes that use the data manager. During initialization of the program, all manager fields of all classes must be initialized with required values. But I don't want to create getters in all classes to access the data manager fields. So...
That's about how I do it.
That's roughly how I do it.
Thanks for the example, it's a bit complicated so far, but in general the idea is clear. Immediately a question arises: ok, if "one level of nesting" - here it is clear, but if there will be several levels of nesting?
Added:
It's also not clear why the cIsDelData field? After all, you can just check m_data against POINTER_DINAMIC in the destructor. Or am I wrong?
If you do inheritance, you will get a lot of unnecessary methods. And the object must be private. So, you will not believe, but the easiest way is to setters for all classes that use data manager.
If all data managers work with the same parameters, it is better not to create objects, but pass a pointer to one data manager. In this case, only one setter is needed to pass the pointer.
Thanks for the example, it's a bit complicated so far, but in general the idea is clear. Immediately a question arises: ok, if "one level of nesting" - here it is clear, but if there will be several levels of nesting?
Added:
It's also not clear why the cIsDelData field? After all, you can just check m_data against POINTER_DINAMIC in the destructor. Or am I wrong?
Thank you, I will think about it.
I'm doing it roughly like this.
what thisCDataManager* m_data line means;
Guys I want to do a thing like this. I have a macro.
As a result I will have 2 macrosfoor andfoor1.
what thisCDataManager* m_data line means;
Guys I want to do a thing like this. I have a macro.
As a result I will have 2 macrosfoor andfoor1.
A pointer to an object.
No offence, but it's too early for you to deal with such macros. First of all, understand why I did this: