Java classes and inheritance

abilonds's Avatar, Join Date: Sep 2011
Newbie Member
Hi Go4Expert o/.
I already introduced myself here, but, I lost my account abilondias, and here I am to shot up a question.

I am developing a Java Web application and need some instructions. There are 4 classes : Functionary, Donor, Receiver and Manager. All of them have almost the same atributtes. Should I use Java Inheritance or make a class for each one.

*I think It would cause some pain when making the database and the setting the values on the Superclass and the childs.

Abilon Dias
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
The one that is more logical is what you should be doing. If you think all those class derive common functionality from some Parent class, you should use inheritance.
ewaldhorn's Avatar, Join Date: Feb 2010
Go4Expert Member

Inheritance isn't a bad thing, and I don't believe it will complicate your code, in fact, it would make it a little bit simpler as you could call the parent methods and to lighten the amount of code in your child classes.

Good design should save you time and effort, if it doesn't, you might need to revisit the design.

Best regards
abilonds's Avatar, Join Date: Sep 2011
Newbie Member
Thanks for the answers. My application can be done with inheritance, and I'm thinking I'm going with it.