Is there's a difference? Between C# & C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is there's a difference? Between C# & C++?

Example Im developing my own game in an Game Engine, when I use c# instead of c++ does it make a difference in the execution? Or Both Are The Same And Equal, But C++ Is More Harder

6th May 2020, 6:22 AM
Arts
Arts - avatar
5 Answers
+ 3
If you are using unity then C# is your way to go as Unity uses Mono, which is a cross-platform implementation of Microsoft’s .NET framework. C# is the primary language of .NET, and all of Unity’s libraries are built using C# code.
6th May 2020, 6:32 AM
Arsenic
Arsenic - avatar
+ 2
Key differences between C++ and C# Both are popular choices in the market; let us discuss some of the major difference: C++ is not a pure object-oriented programming language whereas C# is a pure object-oriented programming language. C++ doesn’t support bound checking for arrays whereas C# supports bound checking of arrays. In C++, a programmer can use pointers anywhere in the program whereas, in C#, programmers can use pointers only in unsafe mode. In the C++ switch statement, the decision variable can’t be a string whereas, in the C# switch statement, it can be a string. C++ doesn’t have the support of automatic garbage collection whereas C# has support for the automatic garbage collector for memory management. In C++ programming language, the foreach loop is not supported whereas in the C# foreach loop is supported. C++ programming language supports multiple inheritances whereas C# programming language doesn’t support multiple inheritances.
6th May 2020, 7:10 AM
SITHU Nyein
SITHU Nyein - avatar
+ 1
Difference Between C++ and C# C# is a multi-paradigm general object-oriented programming language and is designed for common language infrastructure (CLI) language. The NET framework helps to build different types of applications such as web, window, embedded, distributed and database applications. C++ is a general object-oriented programming language with imperative and generic programming features. It is an extension of the C programming language. C++ is an intermediate language as it has both a high level and low-level language features.
6th May 2020, 7:09 AM
SITHU Nyein
SITHU Nyein - avatar
+ 1
[Continue....] In C++ programming language access modifiers are private, public, protected whereas in C# programming language access modifiers are private, public, protected, internal and protected internal. Using C++ programming language, the programmer can develop standalone applications whereas, in C# programming language, a programmer can’t develop standalone applications. In C++ programming language, the programmer can write any code provided syntax is correct but it causes issues to an operating system like crashes whereas, in C# programming language, it alerts programmers about compiler warnings. C++ programming language supports a wide variety of platforms such as Windows, Linux, and Mac whereas C# programming language supports only Windows and Microsoft is working towards cross-platform support.
6th May 2020, 7:12 AM
SITHU Nyein
SITHU Nyein - avatar
+ 1
@SITHU Nyein Maybe I've always called them foreach loops without knowing the correct term, but if C++ doesn't support foreach loops then what is the following construct called? int array[] = { 1, 2, 3, 4 }; for (auto num : array) std::cout << num << '\n'; You are right about garbage collection - although I think you should add that C++ has its own thing called RAII (Resource Acquisition Is Initialization) which grants you automatic memory management via smart pointers without the overhead of a garbage collector. Unlike garbage collection it is also opt-in - so you can choose not to use RAII if, for example, you want to pinpoint the lifetime of your objects or if you want to restrict yourself to c++98 features to have your source compile on older compilers.
6th May 2020, 11:42 AM
Damyian G
Damyian G - avatar