Hello,
I am reading a book on Java at the moment and there is a section that has me very confused and I can't seem to find an answer online (and writing code to try and explain it to myself doesn't work - which may be because I don't understand it).
"If one class is inherited from another, each of them may have its own constructor explicitly defined" (got it)
"As with any other class method, a constructor of a subclass can override the constructor of a superclass" (CAN IT?)
I can't see how that works (or why you might want to do it)
Can anyone explain this?
Thanks
I am reading a book on Java at the moment and there is a section that has me very confused and I can't seem to find an answer online (and writing code to try and explain it to myself doesn't work - which may be because I don't understand it).
"If one class is inherited from another, each of them may have its own constructor explicitly defined" (got it)
"As with any other class method, a constructor of a subclass can override the constructor of a superclass" (CAN IT?)
I can't see how that works (or why you might want to do it)
Can anyone explain this?
Thanks