c# - Types of polymorphism. More than one? -


i still in college , remember hearing 1 type of polymorphism when learning java; however, when in c# class, remember professor talking 4 types of polymorphism.

i aware of subclassing , defining specific behavior within more specific classes, , being able call specific behaviors single method in base class because of interface signature.

what other types, , of big of importance type taught above? why there not taught?

yes there 4 kinds of polymorphism

  1. overloading (same function names, different parameter types. includes operator overloading , done @ compile time)

  2. parametric polymorphism (these templates in c++) compile time

  3. subtype polymorphism (if function has parameter subtype, example car->honda, f(car), function f accept f(honda) well.) runtime

  4. parameter coercion (this implicit type conversion. example, function might require double/real/float, accept int , implicitly upcast parameter) compile time

reference:


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -