Subclassing
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