4 odpowiedzi
+ 2
First of all I added 'toString' method that is use to print different attributes of a class. Secondly I suggest you to learn more concepts of oop like encapsulation(getters/setter) ,inheritance its uses that help you in better understanding. description of tostring method https://www.sololearn.com/Discuss/2242260/?ref=app Here is your code working fine now https://code.sololearn.com/caEs0acSUP5T/?ref=app
17th Apr 2020, 8:36 PM
Muhammad Bilal
Muhammad Bilal - avatar
0
Muhammad Bilal thank you, I will need to do some more research...
17th Apr 2020, 8:43 PM
Yahel
Yahel - avatar
0
Just wanted to add few points. ▪ When you inherit a class, you inherit everything that is either public, protected or members with no access modifier(default). ▪ You cannot override fields, they are hidden by child class. ▪ You can override non-static methods. ▪ Learn and practice constructors, getter and setter methods.
17th Apr 2020, 9:05 PM
Avinesh
Avinesh - avatar
0
Avinesh 👍🏻👍🏻👍🏻
17th Apr 2020, 9:08 PM
Yahel
Yahel - avatar