On Sep 6, 2016, at 17:17 , Gerriet M. Denkmann <gerr...@mdenkmann.de> wrote: > > But what to do about localConstantDependingOnSuper?
Now you’re moving the goal posts. :) I said: > assuming the places of definition aren’t more complicated than in your code and you’re making it more complicated. Anyway, this particular example is fairly easily solved by declaring “localConstantDependingOnSuper” as ‘private(set)’. > I do not think this would work for me. There are several subclasses and the > superclass contains lots of functions (some of which are overwritten by > subclasses). > If the superclass becomes a protocol then all this code had to be duplicated > in each subclass. > > > Another problem: > Super → SubA and SubB. > SubA → SubA1 and SubA2 > SubB → SubB1 and SubB2 > > Both SubA1 and SubB1 have identical functions. As have SubA2 and SubB2. > Multiple inheritance would be a solution here; but neither Objective-C nor > Swift can do this (and I don’t like C++). There’s not necessarily a straightforward conversion from subclassing to protocol composition. It usually takes some fundamental re-thinking of your approach to to the problem. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com