Scala class examples
Notes on Scala’s class :
Parameters of Scala methods are values (val) not variables (var)
Scala method returns the last value computed by the method
// Scala class with a private member
class Shape{
private var vertexes = 0
}
// Scala class with a method
class Shape{
def draw() : Unit = {
// Body of the method
}
}
// Scala class with a method with …