Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   Java classes and inheritance (http://www.go4expert.com/forums/java-classes-inheritance-t26764/)

abilonds 23Sep2011 08:48

Java classes and inheritance
 
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 23Sep2011 09:28

Re: Java classes and inheritance
 
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 23Sep2011 12:24

Re: Java classes and inheritance
 
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

abilonds 23Sep2011 22:19

Re: Java classes and inheritance
 
Thanks for the answers. My application can be done with inheritance, and I'm thinking I'm going with it.

Thanks.


All times are GMT +5.5. The time now is 06:31.