I have several classes look like this:
class A {}
class A1 : A {}
class A2 : A {}
class A3 : A {}
class A4 : A {}
class main {
var a1 : A1
var a2 : A2
var a3s : [A3]
var a4s : [A4]
func getAll() -> [A] {
return ([a1, a2] + a3s + a4s)
}
}
If you take a look on function getAll(), you will see I try to return an Array of all object with type is the base class A. However, I always get the error:
"Binary operator '+(::)' cannot be applied to operands of type '[Any]' and '[a3s]'"
Do you know what the proper way is in this case?