Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You confound the two orthogonal terms "overloading" and "overriding".

Overriding:

  class Foo {
    void f() {}
  }

  class Bar : Foo {
    void f() {}
  }
Overloading:

  class Foo {
    void f(int i) {}
    void f(string s) {}
  }
Go doesn't allow overloading: "method lookup is always by name only, not by signature (type) of the method. In other words, a single type can never have two methods with the same name. Given a method x.M, there's only ever one M associated with x. Again, this makes it easy to identify which method is referred to given only the name. It also makes the implementation of method invocation simple." http://talks.golang.org/2012/splash.article#TOC_11.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: