Class: Class

eg. Class

new eg.Class(def)

A module used to implement an application in object-oriented programming style

애플리케이션을 객체지향 프로그래밍 방식으로 구현할 때 사용하는 모듈

  • def
    Type: Object

    definition. Follow the rules under Literals of objects. Note that "construct" is a key reserved as a constructor function.

    클래스를 정의하는 부분. 객체 리터럴 규칙을 따른다. 단, 'construct'는 생성자 함수로 예약된 키다

    • construct optional
      Type: function

      The constructor of the class

      클래스 생성자 함수 (Optional)

Example
     var Some = eg.Class({
         //Class initialize
        "construct" : function(val){
            this.val = val;
        },
        "sumVal" : function(val) {
            return this.val + val;
        }
     });

     var some = new Some(5);
     some.sumVal(5);//10

Browser Support

Browser Version
Desktop - Internet Explorer 7+
Desktop - Chrome latest
Desktop - Firefox latest
Desktop - Safari latest
Desktop - Edge latest
iOS 7+
Andorid 2.1+ (except 3.x)

Methods

staticeg.Class.extend(oSuperClass, def){eg.Class}

Extends a class.

클래스를 상속한다.

  • oSuperClass
    Type: eg.Class

    Superclass

    상속하려는 클래스

  • def
    Type: Object

    Class definition. Follow the rules under Literals of objects. Note that "construct" is a key reserved as a constructor function.

    클래스를 정의하는 부분. 객체 리터럴 규칙을 따른다. 단, 'construct'는 생성자 함수로 예약된 키다.

    • construct optional
      Type: function

      The constructor of the class

      클래스 생성자 함수 (Optional)

Returns:
Type Description
eg.Class
An instance of a new class

새로 생성된 클래스의 인스턴스

Example
     var Some = eg.Class.extend(eg.Component,{
        "some" : function(){}
     })

instance(){eg.Class}

Returns an instance of a class itself.

클래스 자신의 인스턴스를 반환한다.

Returns:
Type Description
eg.Class
An instance of a class itself

클래스 자신의 인스턴스

comments powered by Disqus