문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top