JavaScript Patterns 6.1 Classical Versus Modern Inheritance Patterns
2014-07-06 23:23 小郝(Kaibo Hao) 阅读(333) 评论(0) 编辑 收藏 举报In Java you could do something like:
Person adam = new Person();
In JavaScript you would do:
var adam = new Person();
JavaScript’s constructor invocation looks as if
Person were a class, but it’s important to keep in mind that Person is still just a function.
Principle
When it comes to adopting an inheritance pattern for your project, you have quite a few options. You should always strive for picking a modern pattern, unless the team is really uncomfortable if there are no classes involved.
References:
JavaScript Patterns - by Stoyan Stefanov (O`Reilly)
作者:小郝
出处:http://www.cnblogs.com/haokaibo/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
出处:http://www.cnblogs.com/haokaibo/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。