经典的Vs原型继承 [英] Classical Vs prototypal inheritance

查看:111
本文介绍了经典的Vs原型继承的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读了两者后,我只是好奇,编程社区如何使用它?
在什么情况下?

After reading about both, I just have curiosity, how programming community uses this? In what situation which?

推荐答案

基于原型的继承更灵活。任何现有对象都可以成为一个类,从中生成其他对象。这对于您的对象提供多组服务和/或在程序到达需要继承的点之前经历了大量状态转换非常方便。

Prototype-based inheritance is more flexible. Any existing object can become a class from which additional objects will be spawned. This is handy where your objects offer several sets of services and/or they undergo a lot of state transformation before your program arrives at the point where the inheritance is needed.

A有关建模方法的广谱讨论,请点击此处: http:// steve-yegge.blogspot.com/2008/10/universal-design-pattern.html

A broad-spectrum discussion of modeling approaches is available here: http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html

这篇关于经典的Vs原型继承的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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