- Declare an array of class objects
- How to pass an instance of a Class to another Class
- MQL4 Learning
An object of Class CTicket will create an object of class CExitStrategy. That is all you need, no other relation between the classes required. CTicket will modify his CExitStrategy object as required calling the methods needed to perform the operations. CExitStrategy will have class variables that will "belong" to the respective CTicket that created the Exit object and will store the required Exit Strategy information for that CTicket object. CTicket just calls CExit methods to get CExit into the state or value needed at each moment.
Hope that helps, otherwise please show your code and we can further comment on it.
Regards
An object of Class CTicket will create an object of class CExitStrategy. That is all you need, no other relation between the classes required. CTicket will modify his CExitStrategy object as required calling the methods needed to perform the operations. CExitStrategy will have class variables that will "belong" to the respective CTicket that created the Exit object and will store the required Exit Strategy information for that CTicket object. CTicket just calls CExit methods to get CExit into the state or value needed at each moment.
Hope that helps, otherwise please show your code and we can further comment on it.
Regards
Thanks for the help.
Ya, that seemed like the most viable method. Thanks!!
Another question:
So I have
Class CTicket
{
private:
CExitStrategy e_exitStrats;
..... (some more variables)
}
and later i created an array of CTickets.
if after initializing an array of 5 CTickets, can I just resize my array to 4? Do i need to do some procedure to release the memory for the released instance of CTicket or e_exitStrats?
Thanks.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use