- Hands-On Design Patterns with Kotlin
- Alexey Soshin
- 70字
- 2021-06-25 20:49:25
Classes
To declare a class, we use a class keyword, exactly like in Java:
class Player {
}
There's no new keyword in Kotlin. The instantiation of a class simply looks like this:
// Kotlin figured out you want to create a new player
val p = Player()
If the class has no body, as in this simple example, we can omit the curly brackets:
class Player // Totally fine
推薦閱讀
- 程序員面試白皮書
- 機器學習系統:設計和實現
- Mastering QGIS
- Reactive Programming with Swift
- Android 7編程入門經典:使用Android Studio 2(第4版)
- 數據結構(Python語言描述)(第2版)
- Effective Python Penetration Testing
- Python編程與幾何圖形
- PLC編程與調試技術(松下系列)
- KnockoutJS Starter
- Building RESTful Python Web Services
- Clojure Reactive Programming
- Getting Started with Greenplum for Big Data Analytics
- 時空數據建模及其應用
- C++程序設計