Difference between C++ and C#

Key difference: C++ is a general-purpose programming language. It was developed from the original C programming language. C++ is a statically typed, free-form, multi-paradigm and a compiled programming language. The C++ programming language is widely considered to be an intermediate-level language, as it made up of both high-level and low-level language features. As compared to C, C++ incorporates object oriented features, such as classes, and other enhancements. C#, also known as C sharp, is an object oriented programming language. C# is a multi-paradigm programming language. It includes strong typing, imperative, declarative, functional, procedural, generic, object-oriented (class-based), and component-oriented programming disciplines. C# is based on the C programming language. It was originally developed by Anders Hejlsberg for Microsoft for use in its .NET framework.

C++ is a general-purpose programming language. It was developed from the original C programming language. It was developed by Bjarne Stroustrup at Bell Labs starting in 1979. C++ was originally named C with Classes. It was renamed C++ in 1983.

C++ is a statically typed, free-form, multi-paradigm and a compiled programming language. The C++ programming language is widely considered to be an intermediate-level language, as it made up of both high-level and low-level language features. As compared to C, C++ incorporates object oriented features, such as classes, and other enhancements.

C++ has taken over some of the popularity of the C language. C++ is now currently implemented on a wide variety of hardware and operating system platforms. It is considered to be an efficient compiler to native code. It also incorporates systems software, application software, device drivers, embedded software, high-performance server and client applications as part of its application domains, as well as entertainment software such as video games.

C++ originally started out as an enhancement to C. It was designed to be source-and-link compatible with C. It added classes, virtual functions, operator overloading, multiple inheritance, templates, exception handling, etc. However, it eventually developed enough to be considered a programming language in its own right. It was originally ratified in 1998 as ISO/IEC 14882:1998.

C++ is now commonly used for hardware design. The design is first described in C++. It is then analyzed, architecturally constrained, and scheduled to create a register-transfer level hardware description language. It would do this through high-level synthesis.

Both free and proprietary C++ compiler software is available in the market. Some examples of these software include the GNU Project, Microsoft, Intel and Embarcadero Technologies. C++ has also had a major influence on other programming languages such as C# (C Sharp) and Java.

C#, also known as C sharp, is an object oriented programming language. C# is a multi-paradigm programming language. It includes strong typing, imperative, declarative, functional, procedural, generic, object-oriented (class-based), and component-oriented programming disciplines.

C# is based on the C programming language. It was originally developed by Anders Hejlsberg for Microsoft for use in its .NET framework. The C# language was later approved as a standard by Ecma (ECMA-334) and ISO (ISO/IEC 23270:2006). C# is one of the programming languages designed for the Common Language Infrastructure. C# is intended to be a simple, modern, general-purpose, object-oriented programming language.

The design goals for C#, as listed by the ECMA standard:

  • The C# language is intended to be a simple, modern, general-purpose, object-oriented programming language.
  • The language, and implementations thereof, should provide support for software engineering principles such as strong type checking, array bounds checking, detection of attempts to use uninitialized variables, and automatic garbage collection. Software robustness, durability, and programmer productivity are important.
  • The language is intended for use in developing software components suitable for deployment in distributed environments.
  • Source code portability is very important, as is programmer portability, especially for those programmers already familiar with C and C++.
  • Support for internationalization is very important.
  • C# is intended to be suitable for writing applications for both hosted and embedded systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions.
  • Although C# applications are intended to be economical with regard to memory and processing power requirements, the language was not intended to compete directly on performance and size with C or assembly language.

As it based on the C language, it is quite similar to it. It even shares some syntactic conventions with C. However, a disadvantage of C# is that, as it was developed by Microsoft for use in its .NET framework, it only works on Microsoft operating systems.

Some differences between C++ and C#:

  • In C++, the programmer has to free the memory, while C# has Garbage collector which frees the memory.
  • C++ supports multiple inheritance, while C# does not.
  • C++ has to use pointers to manipulate memory, while C# can access memory directly.
  • C# uses pointers in codes declared as unsafe.
  • In C++ access modifiers are public, private and protected, while in C# access modifiers are public, private, protected, internal and protected internal.
  • C++ uses semicolon at the end of class definition, while C# does not.
  • C++ supports macros, while C# does not.
  • C# is language type-safe, while C++ is not.
  • C++ code usually compiles to assembly language, while C# code usually compiles to intermediate language.
  • C# does not contain any default constructor.
  • As compared to C++, behavior of the command line arguments is different in C#.
  • Abstract of C# cannot be implemented.
  • C# allows the switch statement to be used with string values.
  • Arrays in C# are of reference type while in C++ arrays are of value type.
  • All the data types in C# are inherited from the object super class and therefore they are objects.
  • In C#, structs are of value type.
  • C# does not support the typed of statement.
  • C# supports native Boolean type and Boolean type data can be implicitly or explicitly cast to any data type except object.
  • C# does not support default arguments.
  • C++ supports bit fields, while C# does not.

Image Courtesy: ocoudert.com, codesmesh.com

Most Searched in Environment Most Searched in Pregnancy and Parenting
Most Searched in Education and References Most Searched in Electronics
Cigarettes vs Cigar
Meteor vs Meteoroid
Photosystem I vs Photosystem II
Joker vs Comedian

Comments

thanks for my assigment help

very thanks

Add new comment

Plain text

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.