测试在github编辑
This commit is contained in:
Evan 2020-02-21 21:15:27 +08:00 committed by GitHub
parent 86a953e088
commit 911913d740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 4 deletions

View File

@ -16,7 +16,6 @@ Student.prototype.hello = function(){ // 在构造函数的原型上定义方法
}
//使用
function createStudent(props) { // 对于new构造函数的封装其优点一是不需要new来调用二是参数灵活
return new Student(props || {}) // 通过new创建构造函数并传入参数/属性
@ -32,7 +31,6 @@ var xiaoming = createStudent({
xiaoming.hello();
//继承
function inherits(Child, Parent) { // 继承的封装方法 inherits(子类, 父类)
var F = function () {}; // 定义空方法F
@ -53,7 +51,6 @@ PrimaryStudent.prototype.getAge = function(){ //对子类添加方法
}
//使用继承后的
function createPrimaryStudent(props) { // 对于new构造函数的封装其优点一是不需要再new来调用二是参数灵活
return new PrimaryStudent(props || {}) // 通过new创建构造函数并传入参数/属性
@ -67,4 +64,3 @@ var xiaohong = createPrimaryStudent({
xiaohong.hello();
xiaohong.getAge();
```