• 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
Subclassing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Subclassing


  • Subject: Subclassing
  • From: "K. Darcy Otto" <email@hidden>
  • Date: Fri, 18 Apr 2008 14:56:42 -0700

I am working on a program with a complex hierarchy of classes, and I want to subclass one of the objects a few steps down on that hierarchy. Do I have to create a parallel hierarchy to do this? Here is the problem:

AppController instantiates a Deduction object.
The Deduction object instantiates a DeductionLine object.
The DeductionLine object instantiates a Dependency object.

I want to subclass Dependency and override a few things. Can I do this without modifying DeductionLine? As it stands, I think I'm going to have to do this:

AppController instantiates a SDeduction object (where SDeduction is a subclass of Deduction).
The SDeduction object instantiates a SDeductionLine object (where SDeductionLine is a subclass of DeductionLine).
The SDeduction object instantiates a SDependency object (where SDependency is a subclass of Dependency).


The only reason to subclass Deduction (with SDeduction) and then DeductionLine (with SDeductionLine) is to get an SDependency object. Is there an easier way? I suppose I could just copy the Dependency class files and then modify it for this particular project; but I was hoping for a different way. Thanks.
_______________________________________________


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: Subclassing
      • From: Manfred Schwind <email@hidden>
    • Re: Subclassing
      • From: Jack Repenning <email@hidden>
    • Re: Subclassing
      • From: Andy Lee <email@hidden>
    • Re: Subclassing
      • From: j o a r <email@hidden>
  • Prev by Date: Re: Capsule-Style Toolbar Controls
  • Next by Date: Re: NSTableView -editColumn:row:withEvent:select: question
  • Previous by thread: Re: Getting an array/tree controller to select newly added managed objects
  • Next by thread: Re: Subclassing
  • Index(es):
    • Date
    • Thread