Chapter 2

  1. A class is a well-defined idea that explains the existence of an entity. A class is a template that contains lists of two things—attributes and behaviors. The object is an instance of a class, an entity that contains all attributes and behaviors that a class describes.
  2. Every class contains a number of attributes and behaviors. Attributes are the characteristics of the class that help to distinguish it from others. Behaviors are the tasks an object should perform.
  3. A constructor is a special type of function used to initialize the properties of the class. Kotlin provides three constructors—a default constructor, a primary constructor, and a secondary constructor. 
  4. Function overloading is a feature where a class can have more than one function with similar names. Each function is uniquely identified by its parameters.
  5. Data classes are special types of classes that generate extra functions for programmers. These functions are tostring(), hashCode(), equals(), and copy()
..................Content has been hidden....................

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