Pergunta

I have a parent class that holds all of the fields that are common between all device types. From that, I have a few derived classes that each hold their unique fields. Say I have device type "Switch" and "Transformer". Both derived classes only have 2-3 of their own unique fields. When doing the UI design (windows forms) in this case.

Should I create two separate forms for each device type or create a user control with all fields that are shared among all devices?

Thank you.

Foi útil?

Solução

Create a user control. You could inherit from this user control in order to add fields to it but as the child controls will share properties and behaviour they should inherit from a common parent.

OOD should help prevent code duplication.

Outras dicas

I would say as in your business logic layer, you can freely use OOP principles (inheritance in this case) also in your presentation layer.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top