Polymorphism in C++

后端 未结 7 1099
甜味超标
甜味超标 2020-11-22 09:01

AFAIK:

C++ provides three different types of polymorphism.

  • Virtual functions
  • Function name overloading
  • Operator overloading
7条回答
  •  再見小時候
    2020-11-22 09:26

    As to ad-hoc polymorphism, it means function overloading or operator overloading. Check out here:

    http://en.wikipedia.org/wiki/Ad-hoc_polymorphism

    As to parametric polymorphism, template functions can also be counted in because they don't necessarily take in parameters of FIXED types. For example, one function can sort array of integers and it can also sort array of strings, etc.

    http://en.wikipedia.org/wiki/Parametric_polymorphism

提交回复
热议问题