首页 > 网站 > WEB开发 > 正文

JavaScript Patterns 6.1 Classical Versus Modern Inheritance Patterns

2024-04-27 14:21:53
字体:
来源:转载
供稿:网友

javaScript Patterns 6.1 Classical Versus Modern Inheritance Patterns

2014-07-06 23:23 by 小郝(Kaibo Hao), ... 阅读, ... 评论, 收藏, 编辑

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)


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表