Skip to content

Latest commit

 

History

History
21 lines (18 loc) · 450 Bytes

2-static-variables-in-class.md

File metadata and controls

21 lines (18 loc) · 450 Bytes

2) static variables in class

  • class 내에 상수 (static) 지정 가능
class Rectangle extends Shape {
    
    static defaultRectangle () {
        return new Rectangle("default", 0, 0, 100, 100)
    }
}
class Circle extends Shape {
    
    static defaultCircle () {
        return new Circle("default", 0, 0, 100)
    }
}
var defRectangle = Rectangle.defaultRectangle()
var defCircle    = Circle.defaultCircle()