Introduction

In the beginning of high-level programming languages, programs were written procedurally. The programming languages available were mainly procedural in nature. A procedural programming language is a language that utilizes a series of structured, well-defined steps to compose programs.

As the software industry grew larger and programs grew bulkier, it became necessary to devise a better approach to designing software. This led to the advent of object-oriented programming languages.

The object-oriented programming model is a model organized around objects and data rather than actions and sequential logic. In object-oriented programming, objects, classes, and interfaces are composed, extended, and inherited toward the goal of building industrial-strength software.

A class is a modifiable and extensible program template for the creation of objects and the maintenance of state through the use of variables, constants, and properties. A class possesses characteristics and behaviors. Characteristics are exposed as variables and behaviors are implemented in the form of methods. Methods are functions that are specific to a class or a collection of classes. Classes have the ability to inherit characteristics and behaviors from other classes. This ability is called inheritance.

Kotlin is a fully object-oriented programming language and hence supports all features of object-oriented programming. In Kotlin, similar to Java and Ruby, only single inheritance is permitted. Some languages, such as C++, support multiple inheritance. A downside to multiple inheritance is that it brings up management issues, such as same name collisions. A class inheriting from another class is referred to as a subclass and the class it inherits from is its superclass.

An interface is a structure that enforces certain characteristics and behaviors in classes. Behavioral enforcements via interfaces can be done by implementing an interface in a class. Similar to classes, an interface can extend another interface.

An object is an instance of a class that may possesses its own unique state.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.245.1