I have a base type and subtypes, like shown below.
class Base {
init() throws {
}
}
class Foo : Base {
override init(data: [UInt8]) throws { }
}
class Bar : Base {
override init(data: [UInt8]) throws { }
}
And now in my code elsewhere I want to "point" to the initializer. So basically I wanna do something like this illegal code:
func foo(data: [UInt8]) {
let ptr = ((data: [UInt8]) -> Base) = conditional ? Foo : Bar
let item = ptr(data: data)
}