-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathch8.kt
51 lines (40 loc) · 860 Bytes
/
ch8.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/** Inheritance with Primary Constructor **/
/*open class Father2{
//Properties
var car:String
var money:Int
//Secondary constructor
constructor(car:String,money:Int)
{
this.car=car
this.money=money
}
//Member function
fun disp()
{
println("Father car : $car")
println("Father Money : $money")
}
}
class Son:Father2{
//Properties
var bike:String
// secondary constructor
constructor(car:String,money:Int,bike:String):super(car,money)
{
this.bike=bike
}
//Member function
fun show()
{
println("Son's Bike : $bike")
println("Father car: $car")
println("Father Money: $money")
}
}
fun main()
{
val s1 = Son("Alt 100",1000,"k10")
s1.show()
}
*/