Object Oriented Programming
Classes
Classes are used to create objects. They are declared using the class
keyword.
To initialize the fields in the class use the init
method.
Each field is accessed under the self
keyword.
Objects
Objects are instances of classes. They are created by calling the class name as a function with whichever arguments are required.
Bounded Methods
Methods are functions that are associated with a class. They are declared inside the class.
Inheritance
Inheritance is used to create a new class that is based on an existing class. The new class inherits the fields and methods of the existing class.
To inherit from a class, use the <
operator.