Friday 15 August 2014

java - Can I create an extention of a class that is already an extention of another class? -



java - Can I create an extention of a class that is already an extention of another class? -

i have class called car, , extention of car, called mazdamx5. can create class extends mazdamx5 contains properties of car, contains modified or overridden properties of mazdamx5, or cause complications? oh, yeah, forgot of import part. how do auto , mazdamx5 in different bundle new extention? import?

you can have class hierarchies this, should consider design implications bit closer. having nested inheritance isn't necessary in lot of cases.

if want each class have shared fields, utilize protected instead of private declaration.

this exclusively legal:

public class auto { } public class mazdamx5 extends auto { } public class someothercar extends mazdamx5 { }

java class extends

No comments:

Post a Comment