On Feb 16, 2013, at 2:18 AM, Uli Kusterer <witness.of.teacht...@gmx.net> wrote: > If ClassA and RootA as well are actually identical, you could probably also > use instancetype. (good summary here: http://nshipster.com/instancetype/)
instancetype is a good solution when applicable. Another solution is to lie a little bit to the compiler. In this case, you don't care with method signature the compiler uses at the call site, because both -rootObject declarations are compatible with each other as long as you don't care about strict type checking. It's not like one method returns an object and the other returns a completely incompatible type like float. You can tell the compiler which one to pick by casting the receiver to a more specific type than id: id someRoot = [ (ClassA *)someObject rootObject ]; // force the compiler to use the declaration for -[ClassA rootObject] -- Greg Parker gpar...@apple.com Runtime Wrangler _______________________________________________ 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