+ 1

Whats wrong with my this code.

Inheritence https://code.sololearn.com/cQvYe6Kxv9Qy/?ref=app

14th Oct 2020, 1:27 PM
Anurag Chaurasiya
Anurag Chaurasiya - avatar
3 Réponses
+ 1
All classes have constructors by default: if you do not create a class constructor yourself, Java creates one for you. However, then you are not able to set initial values for object attributes.
14th Oct 2020, 1:56 PM
JaScript
JaScript - avatar
+ 1
Add a default constructor in cuboid.. Or manually call parent constructor of box with required parameters.. Because parent class contructer is automatically called when child class object is created so there is mitch matching arguments...
15th Oct 2020, 4:38 PM
Jayakrishna 🇮🇳
+ 1
class box extends cuboid{ box(){ super(1,1,1); // dim1=dim2=dim3=1; }
15th Oct 2020, 11:00 PM
zemiak