初始化和单利模式的实现
This commit is contained in:
parent
b80201e982
commit
611a82f17b
13
demo1/InitAndSingleton.ky
Normal file
13
demo1/InitAndSingleton.ky
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
class InitAndSingleton{
|
||||||
|
//初始化
|
||||||
|
init{
|
||||||
|
println("init")
|
||||||
|
}
|
||||||
|
//定义静态方法
|
||||||
|
companion object{
|
||||||
|
//方法实现
|
||||||
|
fun function(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user