Abstract
We can define polymorphic methods using type variables . Polymorphic functions are those that can be applied to data of different types. Polymorphism is different from overloading that corresponds to have different functions with different types but with the same name. For example, addition + in Real and Complex are not polymorphic because we have two different functions with different implementations.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
We will see fold and aggregate in Chap. 8.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
Copyright information
© 2016 Springer International Publishing AG
About this chapter
Cite this chapter
Torra, V. (2016). Types and Classes Revisited: Polymorphism. In: Scala: From a Functional Programming Perspective. Lecture Notes in Computer Science(), vol 9980. Springer, Cham. https://doi.org/10.1007/978-3-319-46481-7_5
Download citation
DOI: https://doi.org/10.1007/978-3-319-46481-7_5
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-46480-0
Online ISBN: 978-3-319-46481-7
eBook Packages: Computer ScienceComputer Science (R0)