On Apr 17, 2011, at 3:52 PM, Joanna Carter wrote: > Hi guys > >> That's only because, unlike java, obj-c doesn't have a way built into the >> language to enforce a class to be abstract. I can see valid reasons to >> subclass a singleton if that singleton is to be used as an abstract class >> and never be instantiated by itself. > > Tell me; maybe it's my background in other languages, but I would tend to use > a "static class" as a singleton; or, at least, design a class with only class > methods/properties, with static "fields" declared in the @implementation > section of a class. > > Why this fascination with going to all the trouble of creating a singleton > rather than using the "static class" approach? > > Joanna
Hi Joanna, not a fascination, but simply a preference and being used to coding that way. As for the "static class" idea, what happens if you need/want to subclass that class? Then you have to search for and change all the places in your code base that refer to it. WT_______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
