Introduction to Extensions
Learn about extension functions in Kotlin, how to define and use them to extend classes, and their similarities to member functions.
Introduction to class members
The most intuitive way to define methods and properties is inside classes. Such elements are called:
Class members
Member functions
Member properties
Press + to interact
class Telephone(// member propertyval number: String) {// member functionfun call() {print("Calling $number")}}fun main() {// Usageval telephone = Telephone("123456789")println(telephone.number) // 123456789telephone.call() // Calling 123456789}