I have 2 classes, class A which is an abstract class, and a class B like
abstract class A(name: String){
//some code
}
class B {
//some code
}
Now if I want to add and array of type class A in Class B it is very simple in java like
class B {
A[][] arr = new A[2][2];
}
but I am trying the same in Kotlin like
class B {
var arr = Array(2) {Array(2) {A}}
}
then it is giving error as "Classifier 'A' does not have a companion object and thus must be initialized here" but then I tried putting some variables in the companion object in the abstract class, and now it does not give any error. but the array is made of type 'A.companion' and not of type 'A'.
Kindly help me if you know anything about this.