Content deleted Content added
note about inaccuracy in java generics section, with example program. |
Remove merge proposal |
||
(15 intermediate revisions by 12 users not shown) | |||
Line 1:
{{Talk header}}
{{Old AfD multi |date=17 December 2021 |result='''keep''' |page=Comparison of Java and C++}}
{{WikiProject
{{WikiProject
{{WikiProject Java |importance=low}}
{{WikiProject C/C++ |importance=low }}
}}
{{User:MiszaBot/config
|archiveheader = {{Talk archive}}
|algo = old(365d)
|maxarchivesize = 100K
|minthreadsleft = 5
|minthreadstoarchive = 1
|counter = 2
|archive = Talk:Comparison of Java and C++/Archive %(counter)d
}}
== remove bounds checking ==
Line 706 ⟶ 53:
! '''C++ Templates''' !! '''Java Generics'''
|-
| Templates can be
|| Generics cannot be specialized.
|}
The below program shows an example of specializing a generic method for a specific template parameter. The "myCount" method is specialized for subclasses (inclusive) of Character. Is this not "providing a separate implementation for a particular template parameter"? It seems to precisely match the definition of "Explicit template specialization" given here: [[
<syntaxhighlight lang="java">
Line 737 ⟶ 84:
return ret*3;
}
public static void main (String[] args) {
Line 753 ⟶ 99:
Thanks,
[[User:Vancan1ty|Vancan1ty]] ([[User talk:Vancan1ty|talk]]) 04:35, 19 November 2015 (UTC)
== nested/inner classes ==
I think the article should also state that C++ nested classes differ from Java inner classes.
C++ nested classes are kinda like a static class in Java and can not access fields in the outer class unless they are static (C++11) [[User:Peter.quiring|Peter.quiring]] ([[User talk:Peter.quiring|talk]]) 22:42, 4 April 2016 (UTC)
|