// Person.prototype --原型
// Person.prototype = {} 是祖先
// Person.prototype.name = "hehe";
// Person.prototype.say = function () {
// console.log("hehe");
// }
// function Person(name, age, sex) {
// }
// var person = new Person();
// var person1 = new Person();
// console.log(person1.name);
// console.log(person.name); //hehe继承祖先的属性
//利用原型的特点和概念
// Car.prototype.height = 1400;
// Car.prototype.lang = 400;
// Car.prototype.carName = "BWM";
// function Car(color, owner) {
// this.owner = owner;
// this.color = color;
// }
// var car = new Car('red',"prof.ji");
//原型的增删改查
// Person.prototype.lastName = "deng";//这里是无效的输出undefined
// Person.prototype = {
// height : 1400,
// lang : 4900,
// carName :"BWM"
// }
// function Person(name) {
// this.name = name;
// }
// var person = new Person("xuming");
// function Person() {
// }
// Car.prototype = {
// // constructor : Car;
// constructor : Person
// }
// function Car() {
// }
// var car = new Car();
// function Person() {
// //var this = {
// // __proto__ : Person.prototype
// // };
// }
// var obj = {
// name : "sunny"
// }
// var person = new Person();
// person.__proto__ = obj;
// console.log(person.name);
// Person.prototype.name = 'sunny';
// function Person() {
// //var this = {__proto__ : Person.prototype}
// }
// var person = new Person();
// Person.prototype = {
// name : 'charry'
// }
// var obj = {name : 'a'};
// var obj1 = obj;
// obj = {name : 'b'};
// Person.prototype = {name : "a"};
// __proto__ = Person.prototype;
// Person.prototype = {name : "b"};
// Grand.prototype.__proto__ --> Object.prototype
// Grand.prototype.lastName = "deng";
// function Grand() {
// }
// var grand = new Grand();
// Father.prototype = grand;
// function Father() {
// this.name = "xuming";
// this.fortune = {
// card1 : "visa"
// };
// this.num = 100;
// }
// var father = new Father();
// Son.prototype = father;
// function Son() {
// this.hobbit = "smoke";
// }
// var son = new Son();
// Person.prototype = {
// // name : "a",
// // sayName : function () {
// // console.log(this.name);
// // }
// height : 100;
// }
// function Person() {
// // this.name = "b"
// this.eat = function () {
// this.height ++;
// }
// }
// var person = new Person();
//var obj = Object.create(原型);
// var obj = {
// name : "sunny",
// age : 123
// };
// var obj1 = Object.create(obj);
// Number.prototype.toString = function () {
// return "老等身体好";
// }
// function Person(name , age) {
// //this == obj
// this.name = name;
// this.age = age;
// }
// var person = new Person('deng' , 100);
// var obj = {
// }
// Person.call(obj,'cheng',134);//利用别人的方法实现自己的功能
//Person() ---> Person.call();
// function Person(name, age, sex) {
// this.name = name;
// this.age = age;
// this.sex = sex;
// }
// function Student(name, age, sex, tel, grand) {
// // Person.call(this, name, age ,sex);
// Person.apply(this, [name, age ,sex]);
// this.tel = tel;
// this.grand = grand;
// }
// var student = new Student('sunny', 123, 'male', 139, 2020);