Created
November 6, 2022 14:37
-
-
Save halilozel1903/44c44511b6e48acda9510f14aab4764b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Car(val horsepowers: Int) { | |
companion object Factory { | |
val cars = mutableListOf<Car>() | |
fun makeCar(horsepowers: Int): Car { | |
val car = Car(horsepowers) | |
cars.add(car) | |
return car | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment