GetterSetter

scalation.GetterSetter
object GetterSetter

The GetterSetter object provides an example of how to create getter and setter methods in Scala 3: private field variable 'name', getter method 'name', setter method 'name='.

Attributes

See also

kkyr.io/blog/getters-and-setters-in-scala

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

inline def width: Double

Get the value of the _width` variable. May use inline for efficiency.

Get the value of the _width` variable. May use inline for efficiency.

Attributes

def width_=(width_: Double): Unit

Set the variable _width to the new value width_ checking its validity. If the error/flaw is severe, may set _width to a default value or throw an exception.

Set the variable _width to the new value width_ checking its validity. If the error/flaw is severe, may set _width to a default value or throw an exception.

Value parameters

width_

the new width to be assigned

Attributes