The document compares C# and C++ programming languages, noting key differences such as C# being a higher-level managed language that uses just-in-time compilation and garbage collection while C++ is lower-level and compiles directly to assembly code. Some differences highlighted are that C# supports properties, delegates and events as class members while C++ only allows variables, functions, constructors and destructors, and C# has features like finally blocks and exceptions that must inherit from System.Exception that C++ lacks.
3. C# is a programming language that is derived from C programming language and C++ programming
language. C# is uniquely designed to be used in .NET platform.
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.
4. 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.
5. Leave feedback & question in the comments
for our channel updates
Hit on like button below
For more visit our website
www.sirykt.blogspot.com