Skip to content

Instantly share code, notes, and snippets.

View arsalankhan994's full-sized avatar

Erselan Khan arsalankhan994

View GitHub Profile
fun main() {
/*
Primary Constructor Example
*/
val primaryConstructorOnly = PrimaryConstructorOnly()
println("My name is ${primaryConstructorOnly.name}")
println("My age is ${primaryConstructorOnly.age}")
val primaryConstructorWithParams = PrimaryConstructorWithParams(
fun main() {
/*
Without Extension Functions
if we are using a class "SomeThirdPartyClass" and
we want to add one more function, then
we need to inherit the "SomeThirdPartyClass" class with
"MyClass" and write that function inside it and
use "MyClass" everywhere instead of "SomeThirdPartyClass" class
*/
fun main() {
/*
Without Extension Functions
if we are using a class "SomeThirdPartyClass" and
we want to add one more function, then
we need to inherit the "SomeThirdPartyClass" class with
"MyClass" and write that function inside it and
use "MyClass" everywhere instead of "SomeThirdPartyClass" class
*/