שאלה בירושה בjava

Yonic106

New member
שאלה בירושה בjava

שלום אולי מישהו יכול לעזור לי. אני מנסה כמה צעדים בjava ונתקלתי בבעיות הבאות. איך אני קורא לconstructor של האבא שלי? ובנוסף, הsuper הוא הפניה רק לאבא שלי?, או גם לסבא ולסב סבא וכו וכו... תודה.
 

ranshe

New member
הורשה

Every constructor has an implicit call to it´s parent constructor (super()). If you want to EXPLICITLY call not the default constructor, you can use super(param list). The Java runtime uses the closest ancestor. for example: if C extends B and B extends A, and only A has doSomething(), then cInstance.doSomething() will execute A´s doSomething(). Kapish?
 
למעלה