inheritance - How to subclass an array class in Swift? -
inheritance - How to subclass an array class in Swift? -
i new in swift. have base of operations class:
class foo{} i want implement foo collection class:
class foos: array<foo>{} but compiler complaining:
inheritance non-protocol, non-class type of 'array'
i have tried other syntax (e.g. [foo] , nsmutablearray<foo>) none of them passes compiler check.
this should simple have googled day , not figure out. know if possible , if is, right syntax?
swift's array type structure, , in swift, base of operations classes must actual classes (that is, class foo) , not structures.
so cannot trying via inheritance array, unfortunately. could, however, store array field within class , forwards methods it, perchance implementing protocols want support, et cetera.
arrays inheritance swift
Comments
Post a Comment