override vs. overload vs. overwrite

override: subclass method overrides base class method means:

  • in different range (in derived class and base class)
  • the same function name
  • the same function signature
  • the return type conforms covariance
  • the base class method is virtual

overload: function overloading means:

  • the same range (in the same class)
  • the same function name
  • different function signature

overwrite: subclass method hides base class method means:

  • in different range (in derived class and base class)
  • the same function name
  • two cases on parameters ( signature? ):
    • the same parameters, the base class method is not virtual
    • different parameters
分享到:

发表评论