Commits

Bożydar Sobczak committed 1605707

Test alias

Comments (0)

Files changed (1)

+class A
+  attr_accessor :a
+  def initialize
+    puts "A:initialize"
+    @a = 1
+  end
+  
+  def test(b)
+    puts "A:test(#{b})"
+  end
+  
+  def to_overwrite
+    puts "A:to_overwrite"
+  end
+    
+end
+
+class B < A
+  
+  alias :super_to_overwrite :to_overwrite
+  
+  def intialize
+    super
+    puts "B:initialize"
+  end
+  
+  def test(b)
+    super(b)
+    to_overwrite
+    super_to_overwrite
+    puts "B:test(#{b})"
+  end
+  
+  def to_overwrite
+    puts "B:to_overwrite"
+  end
+
+end
+
+a = A.new
+a.test("dupa1")
+
+b = B.new
+b.test("dupa2")
+