开发者

Should I share UI for objects that use common fields?

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 fo开发者_开发百科rms) 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜