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
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.
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
Thanks for the answers. My application can be done with inheritance, and I'm thinking I'm going with it. Thanks.