FROM : K. Darcy Otto
DATE : Fri Apr 18 23:56:42 2008
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.
DATE : Fri Apr 18 23:56:42 2008
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.
| Related mails | Author | Date |
|---|---|---|
| K. Darcy Otto | Apr 18, 23:56 | |
| j o a r | Apr 19, 01:02 | |
| Andy Lee | Apr 19, 01:09 | |
| Jack Repenning | Apr 19, 01:17 | |
| Manfred Schwind | Apr 19, 15:13 | |
| Dave Howell | Apr 19, 19:18 |






Cocoa mail archive

