2

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.

Mike
  • 4,257
  • 3
  • 33
  • 47

2 Answers2

3

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.

David Neale
  • 16,498
  • 6
  • 59
  • 85
1

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

Gabriel Ščerbák
  • 18,240
  • 8
  • 37
  • 52