Skip to content

Instantly share code, notes, and snippets.

private const val DURATION = 300
val PERIOD = 3
fun doNothing(){
}
@yuriyskulskiy
yuriyskulskiy / Something.kt
Last active June 15, 2020 01:42
top level declaration
private const val DURATION = 300
val PERIOD = 3
fun doNothing(){
}
@yuriyskulskiy
yuriyskulskiy / Users.kt
Last active June 15, 2020 02:32
property as constructor argument
class BadUser(name:String)
class User(val name: String)
@yuriyskulskiy
yuriyskulskiy / SomeInterface.kt
Created June 15, 2020 02:48
Interface with default function
interface Clickable {
fun getLongClickPeriod(): Int {
return 1000;
}
}
@yuriyskulskiy
yuriyskulskiy / Parent.kt
Created June 15, 2020 03:28
open = not final classes
class Parent {
var name: String = "Evlampiy"
fun flyToAnotherCountry() {
throw UnsupportedOperationException("it's quarantine time, u cant fly")
}
fun doNothing() {
//do nothing
private class PrivateTopLevelCass {
fun printMessage() {
println("hello")
}
}
open class KotlinClass() {
public open var name = "This is property!"
}
open class Ball() {
protected var name = "MyBall"
}
interface PropertyHolder {
val name: String
var age: Int
}
private class Outer {
val outerValue = "Outer value"
class LooksLikeInner {
fun printOuterValue() {
// println(outerValue)
}