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