Skip to main content

Types and Classes Revisited: Polymorphism

  • Chapter
  • First Online:
Scala: From a Functional Programming Perspective

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 9980))

  • 2444 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    We will see fold and aggregate in Chap. 8.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Vicenç Torra .

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics