As in Java, you can use the abstract keyword to denote a class that cannot be instantiated, usually because one or more of its methods are not defined. For example,
abstract class Person(val name: String) {
def id: Int // No method body—this is an abstract method}
You are currently reading a PREVIEW of this book.
Get instant access to over
$1 million worth of books and videos.