By John Godel
Introduction
You should know that many C/C++ developers have been asking this question:
Is C# a new programming language or a new version of C/C++. My answer to
both questions is that none of these definitions is true. Well, in this
article I'm going to go under the hood and show you that C# is a cocktail of
Java, C, C++ and Delphi/C++ Builder from Borland. Let's first take a look
what C# programming language really is.
What is really C# and not?
First of all C# is a programming language. It has a power to develop
software. It is a strong language for network and internet programming. C#
has redefined the programming landscape. In addition, C# designed with the
need of C/C++ and Java programmers. Microsoft created it with Anders
Hejlsberg the former Turbo Pascal and Delphi luminary who was the most
prominent Borland staff also Jbuilder team worked together with him. This
new language has been developed specifically with the .NET framework in
mind, and as such is designated to be the .NET developer's language of
choice. One very important matter about C#, it is the first component
oriented programming language. The hot topic at the moment though is not its
relation to C/C++ or Visual basic, but how it compares to Java and Delphi.
Why Delphi? Because Anders has had a prime role during C# developing. C#
inherits some of it's characteristics from C++ and also is an object
oriented language. C# has the functionality of Java, Delphi and Visual Basic
and it a very strong language. You can not reject Delphi similarity because
theoretically Borland was trying to do the same thing with Borland C++
Builder working on Delphi. But C# has the most functionality of Java and C++
and theoretical similarity with Delphi and Visual Basic to use this Java and
C++ functionality in a RAD environment. You may remember properties term
from both Delphi and Visual Basic. On the other hand, when I read "C#
combines the high productivity of Microsoft Visual Basic® with the raw power
of C++" I quickly remember Borland's words for introduction to Borland C++
Builder. What does all mean? C# is not a clone of Java. C# has more
compatibility, functionality and similarity than Java. Also, C# more similar
to C++ as a programming language. C# stay much closer to C++.
Similarity and difference with C/C++
C# is directly related to C and C++. This is not just an idea, this is real.
As you recall C is a root for C++ and 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 very
similar 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.
Most of the C# basic types have the same names as C++ basic types but they
are not really same. For example a char in C# is equivalent to a wchar_t in
C++. If you decide to move from C++ to C# there are a few things to watch
out to include the changes to new, structs, constructors, and destructors.
Creating and using a component (DLL) in C# is fairly easier than in C++. One
more thing, Borland's C++ Builder was a pure C++ with simple RAD environment
of Delphi and VB. C++ Builder was not a new language. This is one of the
biggest differences between C++ Builder and C#. The CLR (Common Language
Runtime) improves runtime interactivity between program development
simplicity, security and portability. However CLR gives usability for
cross-language integration. In addition to all those CLL has+ a perfect
foundation for a rich set of class libraries.
Conclusion
While there are a number of differences between C++ and C#, the syntax of C#
is not very different from C++ and the transition to the new language is
more easy with RAD environment of .NET. Also .NET's cross language
interoperability can give you the ability to use C++ and C# together
Finally, if you want to use a strong programming language like C++ with the
simplicity of VB and Delphi, than you can use C# powered with CLR.