-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathch9.kt
45 lines (34 loc) · 781 Bytes
/
ch9.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
/** Inheritance with Primary & Secondary Constructor **/
/*open class Father3(_car:String,_money:Int){
//Properties
var car:String=_car
var money:Int=_money
//Member function
fun disp()
{
println("Father car : $car")
println("Father Money : $money")
}
}
class Son1:Father3{
//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 = Son1("Alt 100",1000,"k10")
s1.show()
}
*/