From the course: Learning JVM Languages: JVM, Java, Scala
Unlock this course with a free trial
Join today to access over 22,600 courses taught by industry experts.
OOP in Scala
From the course: Learning JVM Languages: JVM, Java, Scala
OOP in Scala
- [Instructor] Hello, let's start with the new video, OOP in Scala. In the previous video we learned about Scala language syntax and rules. In this video we'll define packages, subpackages, and classes, and import members. We'll also look at instance methods and variables, constructors, extending a class, overloading methods and abstract classes. Also traits, singleton objects, and operator overloading. Case classes are also covered in this video. Similar to Java, the Scala compiler requires code to be wrapped inside a class. The interactive Scala REPL shell works around this limitation by automatically wrapping the entered code in an invisible class that's generated under the hood. When using the Scala command, you can immediately start writing functions or code that must be executed, like you would do in a typical Python or different script language. We'll start with defining packages and subpackages. Scala has a package statement. It can be defined at the top of a file like this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.