File: super

package info (click to toggle)
ruby-bdb 0.6.5-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,028 kB
  • sloc: ansic: 13,984; cpp: 8,735; ruby: 7,869; sh: 47; makefile: 9
file content (28 lines) | stat: -rw-r--r-- 727 bytes parent folder | download | duplicates (18)
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
<entry index='s'>
<name>super</name>
<reference>variable</reference>
<reference>overridde</reference>
<reference>method</reference>
<content>
    Technique to call upper level ((method|Method))
    from ((overridden|Override)) method.
    When argument is omitted, super'ed slave can be called by
    the same argument as that of the master's method.

    : Question:
      If you change the value of ((variable|Variable)) given as an argument,
      which 'super' gets, the original value, or the changed?

        def foo(a)
           print a 
        end
        def self.foo(a)
           a=25
           super
        end
        foo(5)        # 5 or 25?

    : Answer
      the original one(((%5%)))
</content>
</entry>