What’s the difference between C# and C++ in the code itself?

4.72K views

I know that C# is oop, and C++ isn’t, and I know that garbage collection is easier in C#, but what are the actual differences in how lines are written, and why pick one over the other?

EDIT: to clarify, I have c# experience, and I’m considering picking up C++, but whenever I google it, it gives me only the obvious surface level differences

In: Other

2 Answers

Anonymous 0 Comments

Despite the names, C# and C++ are completely separate languages.

C++ is also object oriented, although not as strictly as C# – as an extension of C it still supports C style functions (function without a class), but it has classes just like C#.

Regarding garbage collection in C++ – there is none. You have to keep track of memory that you allocate, and remember to free it when you’re done using it.

Why pick one over the other? C++ is a little closer to the actual hardware, so you can more easily write code that interacts with it (for example software drivers are usually written in C or C++). Game engines are also often written in C++. Otherwise there isn’t a lot of reason to choose it over C++.

One thing you must remember is that a programming language is just a tool, not a target. An experienced programmer should be able to pick up a new language in a matter of days.

You are viewing 1 out of 2 answers, click here to view all answers.