---
title: "JS极简继承"
author: "name327"
date: "2012-07-21T11:48:55Z"
tags: []
categories: ["编程语言"]
slug: "js"
draft: false
lastmod: "2012-07-21T11:48:55Z"
id: 1602596
url: "https://name327.iteye.com/blog/1602596"
---

```
var Person={
		newIntance:function(name){
			var person={};
			person.name=name;
			person.say=function(){
				alert(this.name);
			}
			return person;
		}	
			
	};
	var  p=Person.newIntance("Colin");
	p.say();
	var Student={
		newIntance:function(name,grade){
			var student=Person.newIntance(name);
			student.grade=grade;
			student.say=function(){
				alert(this.name+"---"+this.grade);
			}
			return student;
		}	
			
	};
	
	var s=Student.newIntance("Colin",5);
	s.say();
```

 

  这种方式，可以实现继承的效果，但是不知道有没有什么弊端。先记在这里