If just coercion is a kind of polymorphism, then coercion happens even in non-oops languages. So, i want to know whether the term "coercion" is different from "coercion polymorphism"?
If coercion happens at the time of function call where the type of the argument passed in a function call coerces to the type of the parameter in the function definition and if the same happens with an operator, then we call it "coercion polymorphism". Is this statement, correct? If so, whether such a thing happens in language C(non-oops language)?
In Java, BOXING concept is an example of coercion. Can that be considered as "coercion polymorphism" too?
Passing a subclass object reference to a superclass object reference during a method call can also be considered as "coercion polymorphism"?(I read somewhere). In that case upcasting and coercing polymorphism means the same in a sense. So, is that correct?
Is coercion different from "coercion polymorphism"?
115 views Asked by Kamalapriya Subramanian At
0