Roozbeh Pirooz wrote:Is it even possible to pass an abstract class object as a constructor's parameter since abstract classes cannot be instantiated?
Roozbeh Pirooz wrote:Just to clarify again, I haven't written these classes it's a java quiz/puzzle and I am trying to fix the bugs and make sense of it. I understand that constructors/methods can have different kind of parameters (e.g. abstract, interface or primitive and so on) but what I meant was why it’s being done in the context of the current class hierarchy (AC, CC1, CC2 and CC3) and I asked myself the same question( Parent to Child?).
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
As to the other stuff: One suggestion might be to draw some diagrams. What does this hierarchy look like? Sometimes seeing something helps you to work out if it's wrong in a way that code or words can't.
Winston
Winston Gutkowski wrote:
Well, one possibility is that it's a "copy constructor"
Roozbeh Pirooz wrote:I think what’s being attempted here is to establish which Child is related to Which Parent and also other possible Children in the same family
Jeff Verdegan wrote:
Keep in mind though that "parent" and "child" in terms of a class hierarchy is not at all the same as "parent" and "child" in a biological sense, nor in the sense of nodes in a data structure. People tend to try to take the "parent and child" and "inheritance" analogy too literally, when it really bears very little similarity to the biological case, and then get confused when things don't match what they expected.
Roozbeh Pirooz wrote:
Thanks again Jeff. I always try not to fall into that trap. But I am still struggling to understand why Parent to Child has been used in both constructor/methods here.
Any hint regarding design decision which may justify a case like this?
Enjoy the full beauty of the english language. Embedded in this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|