Appendix D: C for C Developers


Overview

This appendix is intended for developers who are already familiar with C++ and want to see what the differences are between C++ and C#. It surveys the C# language, noting specifically those areas in which it is different from C++. Because the two languages do have a large amount of syntax and methodology in common, advanced C++ programmers may find they can use this appendix as a shortcut to learning C#.

It should be made clear that C# is a distinct language from C++. Whereas C++ was designed for general object-oriented programming in the days when the typical computer was a standalone machine running a command-line-based user interface, C# is designed specifically to work with.NET and is geared to the modern environment of Windows and mouse-controlled user interfaces, networks, and the Internet. There is a similarity between the two languages, particularly in syntax, and this is not surprising because C# was designed as an object-oriented language that took the good points of earlier object-oriented languages — of which C++ has been arguably the most successful example — but learned from the poorer design features of these languages

Because of the similarities between the two languages, developers who are fluent in C++ may find that the easiest way to learn C# is to treat it as C++ with a few differences and learn what those differences are. This appendix is designed to help you do that.

The appendix starts off with a broad overview, mentioning, in general terms, the main differences between the two languages, but also indicating the areas they have in common. This is followed by a comparison of what the standard Hello, World program looks like in each of the two languages. The bulk of this appendix is dedicated to a topic-by-topic analysis that looks at each of the main language areas and gives a detailed comparison between C# and C++; inevitably, an appendix of this size cannot be comprehensive, but it covers all the main differences between the languages that you will notice in the course of everyday programming. It is worth pointing out that C# relies heavily on support from the .NET base class library in a large number of areas. This appendix is largely restricted to the C# language itself and does not extensively cover the base classes.

For the purposes of comparison, ANSI C++ is taken as a reference point. Microsoft has added numerous extensions to C++ (many new extensions with .NET 2.0), but these are not normally used in this appendix when comparing the two languages.




Professional C# 2005
Pro Visual C++ 2005 for C# Developers
ISBN: 1590596080
EAN: 2147483647
Year: 2005
Pages: 351
Authors: Dean C. Wills

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net