<!DOCTYPE html
>
<html lang
="en">
<head
>
<meta charset
="UTF-8">
<meta name
="viewport" content
="width=device-width, initial-scale=1.0">
<title
>Document
</title
>
</head
>
<body
>
<script type
="text/javascript">
function Teacher(){}
function Student(){}
function Buffer(){}
inherit(Student
,Teacher
);
var s
= new Student();
var t
= new Teacher();
console
.log(s
);
console
.log(t
);
function inherit(Target
, Origin
){
function Buffer(){}
Buffer
.prototype
= Origin
.prototype
;
Target
.prototype
= new Buffer();
Buffer
.prototype
.constructor
= Target
;
Buffer
.prototype
.super_class
= Origin
;
}
</script
>
</body
>
</html
>
转载请注明原文地址: https://lol.8miu.com/read-23003.html