| View previous topic :: View next topic |
| Author |
Message |
Aaron Zapashniy
Joined: 04 Jun 2006 Posts: 17 Location: Hungary
|
| To me, List list = new ArrayList(); is a GENERIC list, and List<Wookie> = new ArrayList<Wookie>(); is ..well i wouldn't call it a Template either but it's not generic. |
| |
|
|
|
|
amoralis
Joined: 22 Jun 2006 Posts: 21
|
| If you passed in a List of Parent that was populated by all child classes that would not introduce any problems, but as soon as you try to passing a generified list parameterized to child into a method requiring a list parameterized as parent it has issues... that's stupid. It would not cause any problems. |
| |
|
|
Gladis
Joined: 24 May 2006 Posts: 108
|
| Aaron Zapashniy, std::vector<wookie>; <- I would call that templates. |
| |
|
|
Aaron Zapashniy
Joined: 04 Jun 2006 Posts: 17 Location: Hungary
|
I would ask how you got an STD from a wookie  |
| |
|
|
amoralis
Joined: 22 Jun 2006 Posts: 21
|
| Gladis, I think the reason for the name difference is that in C++ it effects code outcome, in java it doesn't |
| |
|
|
Gladis
Joined: 24 May 2006 Posts: 108
|
| Std is the standard namespace... C++ has templates. |
| |
|
|
amoralis
Joined: 22 Jun 2006 Posts: 21
|
| In java it only represents compile time checking |
| |
|
|
Gladis
Joined: 24 May 2006 Posts: 108
|
amoralis, It SHOULD affect code. Compile time checking leads to a few problems.
For instance... can't create genericized lists. |
| |
|
|
AmeliaR
Joined: 31 May 2006 Posts: 142
|
| The difference is that c++ template generate code. java's generics do not. |
| |
|
|
amoralis
Joined: 22 Jun 2006 Posts: 21
|
| That's what I just said :) |
| |
|
|
|