Question: Consider an unknown language with integer and real types in which 1+ 2, 1.0 + 2, 1 + 2.0, and 1.0 + 2.0 are all
Consider an unknown language with integer and real types in which 1+ 2, 1.0 + 2, 1 + 2.0, and 1.0 + 2.0 are all legal expressions (the question is from the book, Modern Programming Languages: A Practical Introduction by Adam Webber)
a. Explain how this could be the result of coercion, using no overloading.
b. Explain how this could be the result of overloading, using no coercion.
c. Explain how this could result from a combination of overloading and coercion.
d. Explain how this could result from subtype polymorphism, with no overloading or coercion.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
