"> 07-04_class "> 07-04_class ">
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>07-04_class</title>
<script type="text/javascript">
	/*
		# class
		- class 클래스명 {
			constructor(매겨변수_1, ...){
				this.이름 = 매개변수_1;
				.....
				get 메서드명(){}
				
				set 메서드명(){}
				
				메서드명(){}
			}		
		}
	*/
	class Subject {
		constructor(name, credit){
			this.name = name;
			this.credit = credit;
		}
		get getName() { return this.name; }
		
		set setCredit(credit){
			this.credit = credit;
		}
		info(){
			return '과목명 : ' + this.name + ' / ' + this.credit + '학점';
		}
	}
	
	let js = new Subject('javascript', 3);
	console.log('과목명 : ' + js.getName);
	console.log('학점   : ' + js.info());
	console.log('');
	
	js.setCredit = 4;
	console.log(js.info());
</script>
</head>
<body>

</body>
</html>