I have a GridMasterControl user control that contains (among other things) another control called Grid.
Now I need to inherit from the Grid to create an EditableGrid (add editing functionality to the grid).
Then I need to create an EditableGridMasterControl that will be identical to the GridMasterControl, except that it will use the EditableGrid, not the Grid.
Both ways that I can come up with to implement this have problems.
1. I could copy and paste the GridMasterControl and just change the Grid to EditableGrid. Bad idea (wrong code copying).
2. I could get EditableGridMasterControl to inherit from GridMasterControl, and then add the CreateGrid virtual function to GridMasterControl. EditableGridMasterControl can implement this to create an EditableGrid control. This is also a very bad idea, since I will need to modify the constructor file to create the control. I need the constructor file to be clean.
What is the best way to implement this?
EDIT
Just to clarify, I believe that the essence of the problem is that Visual Studio does not allow you to modify the designer files it creates (or at least its very bad idea), and I want to be able to conditionally create another class depending on the situation .
source
share