📜  C++与C#

📅  最后修改于: 2021-05-30 03:44:14             🧑  作者: Mango

C#是一种通用的,现代且面向对象的编程语言,发音为“ C Sharp”。它是由Anders Hejlsberg及其团队领导的Microsoft开发的。
C++是一种静态类型化,多范式且面向对象的编程语言。最初,C++被称为带有类的C。它是由AT&T贝尔实验室的Bjarne Stroustrup开发的。

以下是C++和C#之间的一些主要区别:

Feature C++ C#
Memory Management In C++ memory management is performed manually by the programmer. If a programmer creates an object then he is responsible to destroy that object after the completion of that object’s task. In C# memory management is performed automatically by the garbage collector. If the programmer creates an object and after the completion of that object’s task the garbage collector will automatically delete that object.
Platform Dependency C++ code can be run on any platform. C++ is used where the application needed to directly communicate with hardware. C# code is windows specific. Although Microsoft is working to make it global but till now the major system does not provide support for C#.
Multiple Inheritance C++ support multiple inheritance through classes. Means that a class can extend more than one class at a time. C# does not support any multiple inheritances through classes.
Bound Checking In C++ bound checking is not performed by compiler. By mistake, if the programmer tries to access invalid array index then it will give the wrong result but will not show any compilation error. In C# bound checking in array is performed by compiler. By mistake, if the programmer tries to access an invalid array index then it will give compilation error.
Pointers In C++ pointers can be used anywhere in the program. In C# pointers can be used only in unsafe mode.
Language Type C++ is a low level language. C# is high level object oriented language.
Level of Difficulty C++ includes very complex features. C# is quite easy because it has the well-defined hierarchy of classes.
Application Types C++ is typically used for console applications. C# is used to develop mobile, windows, and console applications.
Compilation C++ code gets converted into machine code directly after compilation. C# code gets converted into intermediate language code after compilation. Object Oriented C++ is not a pure object-oriented programming language due to the primitive data types. C# is a pure object-oriented programming language.
要从最佳影片策划和实践问题去学习,检查了C++基础课程为基础,以先进的C++和C++ STL课程基础加上STL。要完成从学习语言到DS Algo等的更多准备工作,请参阅“完整面试准备课程”