Abstract
This chapter introduces another type of class in Scala; Value Classes. A value class is a type where the actual value being represented by the class is held directly by a variable, rather than needing to that value via a reference (an address in memory). Examples of value types include Booelan, Int and Double which can have the values true, false, 32, 45.7 etc. Such values can be held directly by a variable, rather than accessed via a reference. This can be more efficient for simple types like Int.
This is a preview of subscription content, log in via an institution.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
Copyright information
© 2014 Springer International Publishing Switzerland
About this chapter
Cite this chapter
Hunt, J. (2014). Value Classes. In: A Beginner's Guide to Scala, Object Orientation and Functional Programming. Springer, Cham. https://doi.org/10.1007/978-3-319-06776-6_15
Download citation
DOI: https://doi.org/10.1007/978-3-319-06776-6_15
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-06775-9
Online ISBN: 978-3-319-06776-6
eBook Packages: Computer ScienceComputer Science (R0)