C++ and C# Difference


C#
C++
C# is a high level language that is component oriented.
C++ is a low level and indeed platform neutral programming language.
When compiled, C# code is converted into Intermediate language code. This intermediate language code is converted into executable code through the process called Just-In-Time compilation.
When compiled, C++ code is converted into assembly language code.
In C#, memory management is automatically handled by garbage collector.
In C++, the memory that is allocated in the heap dynamically has to be explicitly deleted.
In C# Switch Statement, the test variable can be a string.
In C++ Switch Statement, the test variable cannot be a string.
In C# switch statement, when break statement is not given, the fall through will not happen to the next case statement if the current case statement has any code.
In C++ switch statement, when break statement is not given, the fall through will happen to the next case statement even if the current case statement has any code.
In addition to for, while and do..while, C# has another flow control statement called for each.
C++ does not contain for each statement.
C# struts can contain only value types. The struts is sealed and it cannot have a default no-argument constructor.
C++ struts behave like classes except that the default access is public instead of private.
In C#, delegates, events and properties can also be specified as class members.
In C++, only variables, constructors, functions, operator overloads and destructors can be class members. Delegates, events and properties cannot be specified as class members.
In C#, the end of the class definition has a closing brace alone.
In C++, the end of the class definition has a closing brace followed by a semicolon.
The access modifiers in C# are public, private, protected, internal and protected internal.
The access modifiers in C++ are public, private, protected. C++ does not have internal and protected internal access modifiers.
C# has finally block in exception handling mechanism. The code statements in the finally block will be executed once irrespective of exception occurrence.
C++ does not have finally block in exception handling mechanism.
The exception in C# can only throw a class that is derived from the System.Exception class.
The exception in C++ can throw any class.
C# does not have the concept of function pointers. C# has a similar concept called Delegates.
C++ has the concept of function pointers.

Similer…..

HTTP And HTTPS

GET And POST

No comments:

Post a Comment