Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 8. Inheritance > Abstract Classes

8.8. Abstract Classes

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.

  

Start a Free Trial