NET中多重继承的替代方法是什么

NET中多重继承的替代方法是什么

本文介绍了.NET中多重继承的替代方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我从2GL迁移到OO时,请如下选择我的对象:
每个屏幕或数据库表都有一个类.

但是,它仍然让人联想起我在80年代学到的高度标准化的2GL.

E.G
我具有用于人员",用户",角色",功能",角色功能","UserRoles",乘客",路线",阶段","RouteStages",票证","RouteTickets"等的类.

在适当的OO世界中,人员可以坐在树的顶部,乘客和用户可以从树中继承,因为他们拥有是"标准.但是用户还需要借鉴从功能继承的角色.

同样,RouteStage类从Route和Stage继承继承方面,这就是在我们考虑故障单属性之前的原因.
然后,当用户进行购买时,可以很好地衡量乘客和机票的冲突".

我正在阅读接口-这是走的路还是这是不折腾的经典案例... ???

When I moved to OO from 2GL choose my objects as follows:
Each screen or database table got a class.

But it still reeks of the heavily normalized 2GL that I learned in the 80s.

E.G
I have classes for Persons, Users, Roles, Features, RoleFeatures, UserRoles, Passengers, Routes, Stages, RouteStages, Tickets, RouteTickets and so on.

In a proper OO world the Person can sit at the top of a tree, Passenger and User can inherit from it as they have the "Is a" criterium. But User also needs to draw from roles who inherit from Features.

Similarly the RouteStage class draws inherits aspects from both Route and Stage, and thats before we factor in Ticket Attributes.

Then for good measure Passenger and Ticket ''collide'' when the user makes a purchase.

I am reading up on Interfaces - is this the path to take or is this a classic case of its not broken... ???

推荐答案




这篇关于.NET中多重继承的替代方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 02:15