January 2018
Intermediate to advanced
434 pages
14h 1m
English
A class derived from another class is called a subclass, whereas the class from which a subclass is derived is called a superclass. In this example, we will create a superclass A and a subclass B. To extend class B, we need to use : in the class declaration, and then add the superclass name with its primary constructor. Let's take a look at the following steps:
open class A
class B:A()
Read now
Unlock full access