class - Limitation with classes derived from generic classes in swift -
i'm trying derive class generic class:
class foo<t> {} class bar : foo<int> {}
but code fails compile en error:
classes derived generic classes must generic
how avoid limitation? possible?
ssreg,
unfortunately official:
you can subclass generic class, subclass must generic class.
let hope apple fixes in future version.
meanwhile, let see opportunity exploit aggregation instead of subclassing.
note:
as poor man's version of solution, 1 use typealias
:
class foo<t> {} class bar<int> : foo<int> {} typealias bar = bar<int>
this way, rest of code can written if apple fixed matter.
Comments
Post a Comment