Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Bill Howell   on Aug 17 In Java Category.

  
Question Answered By: Lily Brown   on Aug 17

It's okay but may not be desirable.

If rough and normal roads have anything in common (i.e. they're both roads) they
would normally be descendents of a common Roads class. However, a normal road
might not be a descendent of a Roads parent, it might just be a Roads object.

But it depends on what the differences are between the two types of roads. If
it's simply an acknowledgement that the rough road is rough, that may just be a
Boolean "rough" attribute of Road (or perhaps an integer scale 1-10 of
"roughness") and not warrant a separate child class at all.

Assuming this is a programming exercise, I'd be tempted to make RoughRoad a
child class of Road and possibly also make NormalRoad a child class of Road, to
experience inheritance as a concept.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Simple program Or get search suggestion and latest updates.


Tagged: