Class
const str5 = new info5("웹쓰", "웹퍼블리셔");
const str6 = new info5("웹스토리보이", "프로그래밍");
document.write("7");
info5.study1();
info5.study2();
document.write("<br>");
함수의 상
class info3 {
constructor(name, active){
this.name = name;
this.active = active;
}
study(){
document.write(this.name + "가" + this.active + "되었습니다.");
}
}
const result3 = new info3("함수 8","실행");
result3.study();
//클래스 상속
class Box1 {
constructor(name, active){
this.name = name;
this.active = active;
}
study(){
document.write(this.name + "가" + this.active + "되었습니다.");
}
}
class Box2 extends Box1 {
constructor(name, active, today){
super(name, active);
this.today = today;
}
study(){
document.write(this.today + this.name + "가" + this.active + "되었습니다.");
}
}
const result4 = new Box1("함수9","실행");
const result5 = new Box2("함수10","실행","오늘도");
result4.study();
result5.study();
result5.study2();
Last updated
Was this helpful?