<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
body {
font-family: "Microsoft YaHei", serif;
}
body, dl, dd, p, h1, h2, h3, h4, h5, h6 {
margin: 0;
}
ol, ul, li {
margin: 0;
padding: 0;
list-style: none;
}
img {
border: none
}
</style>
</head>
<body>
<div id="wrap"></div>
<script>
function A() {}
A.prototype.x = 10;
// ===>>>B继承了A的公有属性
function B() {}
B.prototype = new A;
B.prototype.y = 20;
var b1 = new B();
var b2 = new B();
console.log(b1.x);
console.log(b2.x);
console.log(b1.y);
console.log(b2.y);
var a = new A();
console.log(a.x);
console.log(a.y);
console.dir(B);
// 原型一层一层的找,最后一定是object的原型
// 距离object原型越近,这个原型实例就作用的范围就越广
// 在某一层上的原型 靠近object的不能得到 远离的都可以得到
// 一定不要定义到object的原型上
// 共有属性在prototype里边 就是原型里边
// 私有的直接添加的就是
</script>
</body>
</html>
Python3Turtle