Java classes and inheritance

Newbie Member
23Sep2011,08:48   #1
abilonds's Avatar
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
Go4Expert Founder
23Sep2011,09:28   #2
shabbir's Avatar
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.
Go4Expert Member
23Sep2011,12:24   #3
ewaldhorn's Avatar
Hi.

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
Newbie Member
23Sep2011,22:19   #4
abilonds's Avatar
Thanks for the answers. My application can be done with inheritance, and I'm thinking I'm going with it.

Thanks.