Thursday, March 11, 2010

Different Between C# and C++



What is different between c# and c++



1)
C# compiles straight from source code to executable code,
with no object files.

2)
C# does not separate class definition from implementation.
Class are defined and implemented in the same place and therefore there is
no need for header files.

3)
Command-line parameters array behave differently in c#
as compare to c++.

4)

In c#, class definition does not use a semicolon at the end.

5)

C# does not support multiple code inheritance.

6)

Casting in c# is much safer than in c++.

7)

When overriding a virtual method, we must use the override keyword.

8)

Abstract methods in c# are similar to behave differently in
c# as compared to c##.

9)

C# provides special syntax to initialize arrays efficiently.

10)
Array in c# are always reference types rather than value
types, as they are in c++ and therefore stored in a heap.

11)

In c#, switch can also be used on string values.


12)

C# does not support the labeled break and therefore jumping out of nested loops can be messy.

13)

The set of operators that can be overloaded in c# is smaller compared to c++.

14)

C# does not provide any defaults for constructors.

15)

Destructors in c# behave any defaults for constructors.

16)

In c#, class and definition does not use a semicolon at the end.

17)

The first characters of the Main() function is capitalized. The Main must return either int or void type value.

18)

C# does not support #include statement. (Note that using is not the same as #include).

19)

All the basic value types will have the same size on any system. This is not the case in c or c++. Thus c# is more suitable for writing distributed application.

20)

In c#, data types belong to either value types (which are created in a stack) or reference types(which are created in a heap).

21)

In c#, structs are value types.

22)
C# checks for uninitialized variables and gives error massages at compile time. 23) In c++, an uninitialized variable goes undetected thus resulting in unpredictable output.

24)

In c#, supports a native string type. Manipulation of strings are easily.



http://wschools.blogspot.com

1 comment: