I am converting my C# windows forms application to a C++\CLI windows forms application.
My C# version had a circular dependency between forms. For example, the ‘Main’ form creates ‘Form2’ and shows it, and when Form2 is closed it re-shows the hidden ‘Main’ form by accessing the static Main form instance through Main.activeWindow (in C++ this would require a circular dependency between headers and classes). There is also much more communication between the two forms – ie. ‘Form2’ changing a button color in form ‘Main’, or updating a property.
How can I break this dependency (I just don’t want to have to mess around with forward declarations and such), but still having the same functionality?
Thanks for your help,
Alex
The only way is too split the class definition into the normal .h/.cpp files. Include the declarations in the .h and the bodies in the .cpp where they can see both class definitions.