01 클래스와 인스턴스의 개념 이해

02 자바스크립트의 클래스

var Rectangle = function (width, height){
	this.width = width;
	this.height = height;
}
//프로토타입 메서드
Rectangle.prototype.getArea = function () {
	return this.width * this.height;
}
//스태틱 메서드
Rectangle.isRectangle = function (instance){
	return instance instanceof Rectangle && instance.width > 0 && instance.height > 0;
}

var rect1 = new Rectangle(3,4);
console.log(rect1.getArea()); //12
console.log(rect1.isRectangle(rect1)); // Error
console.lolg(Rectangle.isRectangle(rect1)); // true

03 클래스 상속

04 ES6의 클래스 및 클래스 상속

var Rectangle = class {
	constructor (width, height) {
		this.width = width;
		this.height = height;
	}
	getArea(){
		return this.width * this.height;
	}
};

var Square class extends Rectangle {
	constructor (width){
		super(width, width);
	}
	getArea(){
		console.log('size is : ",super.getArea());
	}
}