Classes and Objects Flashcards
A class ___ and ___ are optional.
header; body
Classes can have a ___ ___ and one or more ___ ___’s.
primary constructor; secondary constructor
‘constructor’ can be omitted if the primary constructor doesn’t have any ___ or ___ ___.
annotations; visibility modifiers
In a class initialization code is placed inside ___ ___.
initializer blocks
A class can contain multiple ___ blocks.
initialization
You can use a ___ ___ when declaring class properties.
trailing comma
Secondary constructors are prefixed with the ___ keyword.
constructor
Each secondary constructor needs to ___ to the primary constructor (directly or indirectly).
delegate
Code in initializer blocks becomes part of the ___ ___.
primary constructor
Code in all ___ ___ and ___ ___ is executed before the secondary constructor body.
initializer blocks; property initializers
What are the 5 things classes can contain?
constructors and initializer blocks; functions; properties; nested and inner classes; object declarations
All classes have a common superclass ___.
Any
Mark a class with ___ to make it inheritable.
open
If the derived class has a primary constructor, the ___ ___ must be initialized there.
base class
If the derived class has no primary constructor, each ___ ___ has to initialize it using the ___ keyword.
secondary constructor; super