类的配对层次结构 [英] an structure of paired hierarchies of classes

查看:96
本文介绍了类的配对层次结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一种设计模式的结构是这样的。 B拥有对A的引用,并且还使用A进行一些工作,并且进一步地,层次结构B中的每个子类在层次结构A中的子类上继承以进行其工作。
它的代码看起来像以及可能值得阅读的 Lambda the Ultimate


is there a design pattern who's structure looks like this. B owns a reference to A, and also do some work using A. and further more, each sub class in hierarchy B relay on a sub class in hierarchy A to do its work. its code looks like https://codereview.stackexchange.com/questions/12412/two-related-hierarchies-of-classes

解决方案

This is a parallel inheritance hierarchy, and more commonly viewed as an anti-pattern.

There's some discussion of it on Ward's Wiki and at Lambda the Ultimate that might be worth reading.

这篇关于类的配对层次结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆