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

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -