Coding just likes Art
This is the blog about the coding, the whole coding and nothing but the coding , so God would help me become a better developer.

How To Call A Overrided Parent Method

1 In Ruby

1.1 Bind & Call

class Parent
  def callee
    puts 'parent method'
  end
end

class Child < Parent
  def callee
    puts 'child method'
  end

  def caller
    Parent.instance_method(:callee).bind(self).call
  end
end

1.2 Method alias

class Parent
  def callee
    puts 'parent method'
  end
end

class Child < Parent
  alias parent_callee callee

  def callee
    puts 'child method'
  end

  def caller
    parent_callee
  end
end

1.3 Super method (ruby 2.2)

class Parent
  def callee
    puts 'parent method'
  end
end

class Child < Parent
  def callee
    puts 'child method'
  end

  def caller
    method(:callee).super_method.call
  end
end

2 In Java

abstract class Parent {
    public void callee() {
        System.out.println("parent method");
    }
}

class Child extends Parent {
    @Override
    public void callee() {
        System.out.println("child method");
    }

    public void caller() {
        super.callee();
    }
}

public class App {
    public static void main(String[] args) {
        new Child().caller();
    }
}

3 In Scala

trait Parent {
  def callee: Unit = println "parent method"
}

class Child extends Parent {
  override def callee: Unit = println "child method"

  def caller: Unit = super.callee
}

4 In CoffeeScript

class Parent
  callee: ->
    console.log "parent method"

class Child extends Parent
  callee: ->
    console.log "child method"

  caller: ->
    @constructor.__super__.constructor.prototype.callee.call @

5 In C#

public class Parent
{
    public void Callee()
    {
        Console.WriteLine("parent method");
    }
}

public class Child: Parent
{
    public void Callee()
    {
        Console.WriteLine("child method");
    }

    public void Caller()
    {
        base.Callee();
    }
}

6 In C++

class Parent {
public:
  void callee();
};

void Parent::callee() {
  cout << "parent method" << endl;
}

class Child: Public Parent {
public:
  void callee();
  void caller();
};

void Child::callee() {
  cout << "child method" << endl;
}

void Child::caller() {
  Parent::callee();
}

int main()
{
  Child *child = new Child();
  child -> caller();
  child -> Parent::callee();
}

7 In Python

class Parent:
    def callee(self):
        print("parent method")

class Child(Parent):
    def callee(self):
        print("child method")

    def caller(self):
        super(Child, self).callee()