• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sensible way to extend base class?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sensible way to extend base class?


  • Subject: Re: Sensible way to extend base class?
  • From: Graham Cox <email@hidden>
  • Date: Wed, 20 May 2009 22:35:06 +1000


On 20/05/2009, at 10:24 PM, Jerry Krinock wrote:

I believe a short version of your question is: "How can I get multiple inheritance?" The short answer is that Objective-C does not support multiple inheritance.

Yep. I know that, which is why I'm trying to find an elegant workaround.

Any solution I've missed?

Re-think your design so that the required ivars can be stored in a delegate. If desired to make it more fool-programmer-proof and reuseable, declare the delegate with an informal or formal protocol.


The problem there is that A doesn't have a delegate, and adding one requires an ivar... back to square 1.

I'm trying to pretend I don't have access to the source for A, which would be the case for a Cocoa class for example. Let's pretend that :) Adding a 'delegate' ref would be just about acceptable, though it would be unused entirely in the framework that provides the object.

--Graham



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Sensible way to extend base class?
      • From: Jonathan del Strother <email@hidden>
References: 
 >Sensible way to extend base class? (From: Graham Cox <email@hidden>)
 >Re: Sensible way to extend base class? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: [Core Data] Difference between objectWithID: and a fetch "self IN %@", someObjectIDs ????
  • Next by Date: Re: Sensible way to extend base class?
  • Previous by thread: Re: Sensible way to extend base class?
  • Next by thread: Re: Sensible way to extend base class?
  • Index(es):
    • Date
    • Thread