- Learn Kotlin Programming(Second Edition)
- Stephen Samuel Stefan Bocutiu
- 107字
- 2021-06-24 14:13:32
Data classes
It happens quite often that we need to define classes for the sole purpose of holding data. If you have been coding in Scala, I'm sure case classes will come to your mind. Kotlin provides a similar concept, but the term is known as data classes. We will talk a bit more about this type of class in detail in a later chapter, but for now you can define such a class as follows:
data class Customer(val id:Int, val name:String, var address:String)
The compiler does a lot for us when we define a data class, but we will leave these details for later.
推薦閱讀
- Boost.Asio C++ Network Programming(Second Edition)
- What's New in TensorFlow 2.0
- Boost C++ Application Development Cookbook(Second Edition)
- Python程序設計(第3版)
- Hands-On RESTful Web Services with Go
- 3D少兒游戲編程(原書第2版)
- Node.js Design Patterns
- BeagleBone Black Cookbook
- LabVIEW虛擬儀器入門與測控應用100例
- HTML5權(quán)威指南
- Citrix XenServer企業(yè)運維實戰(zhàn)
- Unity 2018 Augmented Reality Projects
- 從零開始:UI圖標設計與制作(第3版)
- SQL Server 2016 從入門到實戰(zhàn)(視頻教學版)
- WildFly Cookbook