Advertisement

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 type class is hold directly by a variable, rather than needing to access 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.

Copyright information

© Springer International Publishing AG 2018

Authors and Affiliations

  1. 1.Midmarsh Technology LtdBath, WiltshireUK

Personalised recommendations