Jan-19-2018, 07:17 AM
(Jan-18-2018, 07:32 PM)nilamo Wrote: Instead ofif_over
inheriting from all three other classes, it should only inherit fromThird
, which in turn extendsSecond
, which then extendsFirst
.
The reasoning being that Second usesself.x
, which is only defined in First, and Third usesself.z
, which is only defined in Second. So those classes should extend from what they need, so they can be used by themselves. Your code, as it is, will never work if you try to create an object of any class EXCEPTif_over
. Ideally, each piece of the chain will work, and the next piece adds more, instead of the bottom piece being the only usable one.
thanks for the tip brother,the explanation makes so much sense.
any suggestion to how i may solve this issue?