MarkRS
01/19/2022, 4:06 PMclass childClass(child: childClass?) : parentClass(child) {
constructor() : this( null)
but this breaks when calling it as childClass().
The parent class I'm trying to inherit from is a Java class, "Path" from android.graphics, but I assume that doesn't matter. I've checked that code and it claims to accept a null.Rob Elliot
01/19/2022, 4:10 PMclass ChildClass(child: ChildClass? = null) : ParentClass()
or this?
class ChildClass(child: ChildClass?) : ParentClass() {
constructor(): this(null)
}
Rob Elliot
01/19/2022, 4:12 PMchild
to the ParentClass's constructor:
class ChildClass(child: ChildClass? = null) : ParentClass(child)
ephemient
01/19/2022, 4:43 PMclass Child : Parent {
constructor() : super()
constructor(p) : super(p)
MarkRS
01/19/2022, 5:14 PMKlitos Kyriacou
01/19/2022, 5:20 PMMarkRS
01/19/2022, 5:21 PMMarkRS
01/19/2022, 5:22 PMKlitos Kyriacou
01/19/2022, 5:24 PMMarkRS
01/19/2022, 5:30 PMKlitos Kyriacou
01/19/2022, 5:53 PMPath(null)
, albeit valid in itself, causes a crash somewhere down the line. If you want to create an empty Path then you need to call Path()
which is very different to Path(null)
.MarkRS
01/19/2022, 6:31 PM