DCL

An elegant OOP with mixins + AOP for JavaScript.

inherited.get()

Version 1.x

This function is an alias for getInherited().

Description

See getInherited() for details.

Examples

inherited.get()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var B = dcl(A, {
  // The inherited.get() way:
  calcPrice1: function(x){
    var sup = this.inherited.get.call(this, B, "calcPrice1");
    if(sup){
      return sup.apply(this, arguments);
    }else{
      // There is no super method.
      return 0;
    }
  },

  // The getInherited() way:
  calcPrice2: function(x){
    var sup = this.getInherited(B, "calcPrice2");
    if(sup){
      return sup.apply(this, arguments);
    }else{
      // There is no super method.
      return 0;
    }
  },

  // Compare it with dcl.superCall() example:
  calcPrice3: dcl.superCall(function(sup){
    return function(x){
      if(sup){
        return sup.apply(this, arguments);
      }else{
        // There is no super method.
        return 0;
      }
    };
  })
});

FAQ

When should I use inherited.get()?

It is there mostly for legacy reasons. In general it is recommended to use getInherited().