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

发表评论

电子邮件地址不会被公开。 必填项已用*标注

3 × 2 =

8 + 1 =