I am a N00b to OO. and people throw flames at me for not answering or not having any points. what can I say except,I am not qualified!!!
Anyways here is my question I have seen more than enough examples of inheritance in your classic "Book" samples Animal, where Bear growls, Cat meows etc...
Let's say I am creating Windows Controls dynamically based on some data coming form(database, XML)
Let's say I create some static factory called CreateControl and I pass in the control type c for combobox, t for textbox etc so I have the following syntax Control c = CreateControl('c'); this returns to me a ComboBox
so far the factory pattern is working. anytime I want to introduce another control, I go to the factory pattern switch statement and add another control type.
In my winforms, for each control I create using this robust factory pattern I want to create eventhandlers based on what control I get back for example if I am creating ComboBox I create eventhandlers for 5 different events If the control is Textbox there are 2 events. so depending on what control is created there are different event handlers with different signatures.
some events require values coming from the form where the controls are sitting, some don't
I have this switch statement for declaring events based on controls I create! how do I take that part of the code in the code behind and do the right thing which is separation of concerns and little or zero code in the code behind!!
Thank you for your help