Saturday, 7 May 2011

Comparison between other Programming Languages

Similarity and difference with C/C++
  C# is directly related to C and C++, C++ is a superset of C. C and C++ shares several syntax, library and functionality. In addition structures, unions, arrays, strings and pointers are most important and similar functionality for both languages.
  C# inherits most of its operators, keywords, and statements directly from C++. Enums are clearly a meaningful concept in C++.
Finally I can clearly say that C# is the first component-oriented language in the C/C++ family.
   C# constructors are verisimilar with C++ constructors. Like C++, methods are non-virtual by default, but can be marked as virtual.

   There is also some difference between C# and C++, C# supports multiple inheritance of interfaces, but not of classes. Another difference is destructors, their syntax is same with C++ but actually they are very different.
 
Difference between C# and VB
C# allows 'unsafe' code, or pointer manipulation. VB allows methods with optional parameters.
C# allows assignments embedded in expressions (e.g., if ((x = y.Value) == 2)).VB allows types within interfaces.
C# has anonymous methods.VB has the very flexible Select construct (much more flexible than the C# switch).
C# has the useful conditional ternary operator (?:). The VB If function is not a good substitute since the arguments must all be evaluated. VB has the When filter for catch block headers (no equivalent exists in C#).
Difference between C# and Java
Features of C# not present in Java
C# provides integration with COM.
C# has "Explicit Member Implementation" which allows a class to specifically implement methods of an interface, separate from its own class methods.
C# has the ability to alias namespaces.
C# has support for output parameters, aiding in the return of multiple values, a feature shared by C++ and SQL.
C# implements properties as part of the language syntax.
C# allows switch statements to operate on strings.

No comments:

Post a Comment