分享
 
 
 

A Compared Overview of C++, C#, and Java

王朝c#·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

/**************************************************************************************************************

A Compared Overview of C++, C#, and Java

Quick and rough comparisons of various features of C++, C#, and Java.

Just for those built into the language itself, not capabilities supported by libraries.

**************************************************************************************************************/

/*

1. Features overview

C++ C# Java

---------------------------------------------------------------------------------------------------------------

Array bounds checking N Y Y

Built-in strings N Y Y

Conditional compilation Y Y N

Covariant return types Y N N

Direct access to C Y N N

Direct access to hardware Y N N

Direct native code generation Y N N

Dynamic class loading N N Y

Enumerated types Y Y N

Exception handling Y Y Y

Explicit memory allocation control Y N N

Function delegates N Y N

Function overloading Y Y Y

Garbage Collection N Y Y

Generates standard object files Y N N

Guaranteed initialization N Y Y

Inline assembler Y N N

Inner classes N N Y

Interfaces Y(*) Y Y

Independent of VM Y N N

Lightweight arrays Y N N

Lightweight objects Y Y N

Macro text preprocessor Y N N

Modules Y Y Y

Multiple Inheritance Y N N

Nested functions N N N

Operator overloading Y Y N

Out function parameters Y Y N

Properties N Y N

Static construction order N Y Y

String switches N Y Y

Templates Y N (*) N (*)

Thread synchronization primitives N Y Y

try-catch-finally blocks N Y Y

Use existing debuggers Y N N

---------------------------------------------------------------------------------------------------------------

2. Keywords

Notice, the same keyword may have subtle difference in different languages in a way.

C++ C# Java

---------------------------------------------------------------------------------------------------------------

abstract N Y Y

as N Y N

base N Y N

bool Y Y N

boolean N N Y

break Y Y Y

byte N Y Y

case Y Y Y

catch Y Y Y

char Y Y Y

checked N Y N

class Y Y Y

const Y Y Y

const_cast Y N N

continue Y Y Y

decimal N Y N

default Y Y Y

delegate N Y N

delete Y N N

do Y Y Y

double Y Y Y

dynamic_cast Y N N

else Y Y Y

enum Y Y N

extends N N Y

event N Y N

explicit Y Y N

extern Y Y N

false Y Y Y

final N N Y

finally N Y Y

float Y Y Y

for Y Y Y

foreach N Y N

friend Y N N

goto Y Y Y(*)

if Y Y Y

implements N N Y

implicit N Y N

import N N Y

in N Y N

instanceof N N Y

inline Y N N

int Y Y Y

interface N Y Y

internal N Y N

is N Y N

lock N Y N

long Y Y Y

mutable Y N N

namespace Y Y N

native N N Y

new Y Y Y

null N Y Y

object N Y N

operator Y Y N

out N Y N

override N Y N

params N Y N

package N N Y

private Y Y Y

protected Y Y Y

public Y Y Y

readonly N Y N

register Y N N

ref N Y N

reinterpret_cast Y N N

return Y Y Y

sbyte N Y N

sealed N Y N

short Y Y Y

signed Y N N

sizeof Y Y N

stackalloc N Y N

static Y Y Y

static_cast Y N N

strictfp N N Y

super N N Y

string N Y N

struct Y Y N

switch Y Y Y

synchronized N N Y

template Y N N

this Y Y Y

throw Y Y Y

throws N N Y

transient N N Y

true Y Y Y

try Y Y Y

typedef Y N N

typeof N Y N

typeid Y N N

typename Y N N

uint N Y N

ulong N Y N

unchecked N Y N

unsafe N Y N

ushort N Y N

union Y N N

unsigned Y N N

using Y Y N

virtual Y Y N

void Y Y Y

volatile Y Y Y

while Y Y Y

---------------------------------------------------------------------------------------------------------------

3. Operators

C++ C# Java

---------------------------------------------------------------------------------------------------------------

Addition + + +

Subtraction - - -

Multiplication * * *

Division / / /

Integer Division /

Modulus % % %

Assignment = = =

Addition Assignment += += +=

Subtraction Assignment -= -= -=

Multiplication Assignment *= *= *=

Division Assignment /= /= /=

Integer Division Assignment /=

Modulus Assignment %= %= %=

Left shift << << <<

Right shift >> >> >>

Left shift assignment <<= <<= <<=

Right shift assignment >>= >>= >>=

Bitwise AND & & &

Bitwise inclusive OR | | |

Bitwise exclusive OR ^ ^ ^

Logical AND && && &&

Logical OR || || ||

Logical Negation ! ! !

Bitwise AND Assignment &= &= &=

Bitwise exclusive OR Assignment ^= ^= ^=

Bitwise inclusive OR Assignment |= |= |=

One's Complement ~ ~ ~

Less than < < <

Less than or equal to <= <= <=

Greater than > > >

Greater than or equal to >= >= >=

Equality == == ==

Not equal != != !=

Compare reference type x is MyClass x instanceof MyClass

Compare string some functions == or String.Equals() String.equals()

concatenate string + +

Scope resolution :: . and base

Subscript [ ] [ ] [ ]

Function call ( ) ( ) ( )

Type conversion (SomeType) and something else (SomeType) (SomeType)

Member access . or -> . .

Postfix increment ++ ++ ++

Postfix decrement -- -- --

Indirection * * (for unsafe code)

Address-of & & (for unsafe code)

Prefix increment ++ ++ ++

Prefix decrement -- -- --

Size of type sizeof sizeof

Comma , ,

Conditional ?: ?: ?:

Pointer-to-member .* or -> . (for unsafe code)

Reference &

---------------------------------------------------------------------------------------------------------------

4. Simple escape sequences

C++ C# Java

---------------------------------------------------------------------------------------------------------------

\a Y Y N

\b Y Y Y

\f Y Y Y

\n Y Y Y

\r Y Y Y

\t Y Y Y

\v Y Y N

\" Y Y Y

\' Y Y Y

\\ Y Y Y

---------------------------------------------------------------------------------------------------------------

5. Comments

C++ C# Java

---------------------------------------------------------------------------------------------------------------

\\ Y Y Y

/* */ Y Y Y

/** */ N N Y

/// N Y N

---------------------------------------------------------------------------------------------------------------

*/

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有