```class book(){ var pages:Int=300 } class pup...
# announcements
a
Copy code
class book(){
    var pages:Int=300
}
class puppy(b: book)
{
    fun removePages():Int=b.pages-Random().nextInt(0,100)
}

fun book.getWeight():Double=pages*1.5
val hamlet=book()
val puppy=puppy(hamlet)
fun book.CountPages(i:Int):Int=pages-i
println("${hamlet.CountPages(20) } \n")
println("${hamlet.getWeight()} \n")
println("${puppy.removePages()+hamlet.CountPages(20)}")
i
Copy code
class puppy(val b: book)
m
b
is provided to the constructor, but it’s not a property of the class
puppy
. try
Copy code
class puppy(val b: book)
Edit : too slow :)
👍 2
a
Thanks
Still it's showing an error
Can't create an instance of abstract class
This is the error
i
Copy code
Random.nextInt(0,100)