Scala - Class

Card Puncher Data Processing

About

Classes in Scala are:

  • very similar to classes in Java.
  • are templates containing fields and methods. Like in Java, classes can be instantiated using the new construct, there can be many “instances” (or “objects”) of the same class.

Properties

Classes in Scala cannot have static members. You can use objects to achieve similar functionalities as with static members in Java.

Special kind of class: classes

In Scala there exists a special kind of class named case classes.

Signature

See Scala - Type





Discover More
Card Puncher Data Processing
Scala - Mixin (Composition)

When a trait is being mixed into a class or trait, it is called a mixin.
Card Puncher Data Processing
Scala - Object (Singleton)

Object in Scala are like classes, but for every object definition there is only one single instance (See ). It is not possible to create instances of objects using new, instead you can just access the...
Card Puncher Data Processing
Scala - Source File

Scala source code is stored in text files with the extension .scala. Typically Scala programmers create: one source file for each class, or one source file for a class hierarchy. In fact, Scala...
Card Puncher Data Processing
Scala - Type

Every variable and expression in a Scala program has a type that is known at compile time. A type restricts the possible values to which a variable can refer, or an expression can produce, at run time....



Share this page:
Follow us:
Task Runner