Ok, I am going back to the basics and trying to pick up some things that I missed when I started on JAVA and this is one of them.
Let's say I have a Class that I created and I have overloaded constructors, so for an example class let's say:
As you can see, 3 of the constructors will actually share some functionallity. All 3 will do the same thing with String name.
So my question is, do I just put the funcationllity for handling String name in all 3 methods or is there a more OO approach to doing this. And likewise for handling int x in the 2nd the 3rd constructor.
I know that I could create another method called someething like handleName(String name) and call that from each constructor, but that seems the same as just adding the functionallity into each constructor. Especially if the handleString only does something really simple.
Thanks.
[ June 06, 2003: Message edited by: Gregg Bolinger ]
Let's say I have a Class that I created and I have overloaded constructors, so for an example class let's say:
As you can see, 3 of the constructors will actually share some functionallity. All 3 will do the same thing with String name.
So my question is, do I just put the funcationllity for handling String name in all 3 methods or is there a more OO approach to doing this. And likewise for handling int x in the 2nd the 3rd constructor.
I know that I could create another method called someething like handleName(String name) and call that from each constructor, but that seems the same as just adding the functionallity into each constructor. Especially if the handleString only does something really simple.
Thanks.
[ June 06, 2003: Message edited by: Gregg Bolinger ]