Difference​s between C++ and C-Sharp (C#)

Difference​s between C++ and C-Sharp (C#)

C++ and C-Sharp (also known as C#) are very similar in the way they are coded.  The syntax has extremely subtle difference. However there are key differences in what each language is capable of.  One big difference between the two languages is the garbage collection feature in C#.  In C++ you must use destructors to destroy your objects while C# handles this by itself.  This makes it easier to not worry about memory leaks etc. but this also means less control over when an object is destroyed.  Another key feature between the two languages is that C++ allows for multiple inheritances in each class.  C# however only allows for one for every method.  C# does not use pointers, instead they use references which are like the references in C++ but with less limitation to what they can do.  C# does not have any header files which makes the code easier and faster for the compiler to parse.  In addition the order in which classes appear in C# are not important they can be arranged in any order.  C++ can declare global variables used throughout the program C# can not.  C++ compiles into assembly language while C# compiles into intermediate language similar to java.  C# was designed to be a higher level language doing many things for the programming while letting go of some of the control.  C++ on the other hand does less thing for the programmer but allows for much greater control on what happens within the program.  Many of C#’s automated features must be coded in manually in C++.

2 comments: