C、C# 和 C++ 在实际应用方面有什么区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/692225/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 13:41:29  来源:igfitidea点击:

What are the differences between C, C# and C++ in terms of real-world application

c#c++ccomparison

提问by jerebear

As I posted earlier hereI've decided to try my hand at one of these but given my interests as a web developer, I'd like to know the difference between them in their real-world applications.

正如我之前在这里发布的那样我决定尝试其中之一,但鉴于我作为 Web 开发人员的兴趣,我想知道它们在实际应用程序中的区别。

Edit Note:

编辑注:

While I'm a web developer, please don't let that limit your answer. I'm 30...I've got years of career changing ahead of me.

虽然我是一名网络开发人员,但请不要让这限制了您的回答。我 30 岁……我有多年的职业生涯变化。

采纳答案by RedBlueThing

Both C and C++ give you a lower level of abstraction that, with increased complexity, provides a breadth of access to underlying machine functionality that are not necessarily exposed with other languages. Compared to C, C++ adds the convenience of a fully object oriented language(reduced development time) which can, potentially, add an additional performance cost. In terms of real world applications, I see these languages applied in the following domains:

C 和 C++ 都为您提供了较低级别的抽象,随着复杂性的增加,提供了对其他语言不一定公开的底层机器功能的广泛访问。与 C 相比,C++ 增加了完全面向对象语言的便利性(减少了开发时间),这可能会增加额外的性能成本。在实际应用方面,我看到这些语言应用于以下领域:

C

C

  • Kernel level software.
  • Hardware device drivers
  • Applications where access to old, stable code is required.
  • 内核级软件。
  • 硬件设备驱动程序
  • 需要访问旧的、稳定的代码的应用程序。

C,C++

C、C++

  • Application or Server development where memory management needs to be fine tuned (and can't be left to generic garbage collection solutions).
  • Development environments that require access to libraries that do not interface well with more modern managed languages.
  • Although managed C++ can be used to access the .NET framework, it is not a seamless transition.
  • 需要微调内存管理的应用程序或服务器开发(不能留给通用垃圾收集解决方案)。
  • 需要访问不能与更现代的托管语言良好交互的库的开发环境。
  • 尽管托管 C++ 可用于访问 .NET 框架,但它并不是无缝过渡。

C# provides a managed memory model that adds a higher level of abstraction again. This level of abstraction adds convenience and improves development times, but complicates access to lower level APIs and makes specialized performance requirements problematic.

C# 提供了一个托管内存模型,它再次添​​加了更高级别的抽象。这种抽象级别增加了便利性并缩短了开发时间,但会使访问较低级别的 API 变得复杂,并使专门的性能要求成为问题。

It is certainly possible to implement extremely high performance software in a managed memory environment, but awareness of the implications is essential.

在托管内存环境中实现极高性能的软件当然是可能的,但了解其含义是必不可少的。

The syntax of C# is certainly less demanding (and error prone) than C/C++ and has, for the initiated programmer, a shallower learning curve.

C# 的语法肯定比 C/C++ 要求更低(并且容易出错),并且对于初学者来说,学习曲线更浅。

C#

C#

  • Rapid client application development.
  • High performance Server development (StackOverflow for example) that benefits from the .NET framework.
  • Applications that require the benefits of the .NET framework in the language it was designed for.
  • 快速的客户端应用程序开发。
  • 受益于 .NET 框架的高性能服务器开发(例如 StackOverflow)。
  • 需要 .NET 框架在其设计语言中的优势的应用程序。

Johannes R?sselmakes the valid point that the use C# Pointers, Unsafe and Unchecked keywords break through the layer of abstraction upon which C# is built. I would emphasize that type of programming is the exception to most C# development scenarios and not a fundamental part of the language (as is the case with C/C++).

Johannes R?ssel提出了有效的观点,即使用 C# 指针、Unsafe 和 Unchecked 关键字突破了构建 C# 的抽象层。我要强调的是,编程类型是大多数 C# 开发场景的例外,而不是语言的基本部分(就像 C/C++ 的情况一样)。

回答by MarkusQ

For raw speed, use C. For power, use C++. For .net compatibility, use C#. They're all pretty complex as languages go; C through decades of gradual accretion, C++ through years of more rapid enhancement, and C# through the power of Microsoft.

对于原始速度,请使用 C。对于功率,请使用 C++。对于 .net 兼容性,请使用 C#。随着语言的发展,它们都非常复杂;C 经历了几十年的逐渐积累,C++ 经历了多年的快速增强,C# 经历了微软的力量。

回答by Colas Nahaboo

From your other posts, I guess you want to learn a new language to get new skills. My advice is that the language is not really important, what is important is the quality of its community (advice, but also existing code you can read and learn from) and the available libraries/frameworks. In this respect, I think the "C family" is not the best choice for you: web libraries and frameworks are few, not portable and not great, and coding style of code you can study varies a lot and may confuse you a lot. (Although C is my favorite language)

从你的其他帖子中,我猜你想学习一门新语言来获得新技能。我的建议是语言并不重要,重要的是其社区的质量(建议,还有您可以阅读和学习的现有代码)和可用的库/框架。在这方面,我认为“C家族”不是您的最佳选择:Web库和框架很少,不便携,也不出色,您可以学习的代码编码风格千差万别,可能会让您感到困惑。(虽然C是我最喜欢的语言)

I would advise to just learn C, and try to really understand the concept of pointers, then move to other languages more adapted to the web (python or javascript comes to mind - or even java). Also, in the C family, Objective-C has the best mix of power and simplicity in my opinion, but is a niche player.

我建议只学习 C,并尝试真正理解指针的概念,然后转向更适合网络的其他语言(想到 python 或 javascript - 甚至是 java)。此外,在我看来,在 C 系列中,Objective-C 具有强大和简单的最佳组合,但它是一个小众玩家。

回答by Eclipse

C is the bare-bones, simple, clean language that makes you do everything yourself. It doesn't hold your hand, it doesn't stop you from shooting yourself in the foot. But it has everything you need to do what you want.

C 是一种准系统、简单、干净的语言,它使您可以自己做所有事情。它不会握住您的手,也不会阻止您用脚射击自己。但它拥有做你想做的一切所需的一切。

C++ is C with classes added, and then a whole bunch of other things, and then some more stuff. It doesn't hold your hand, but it'll let you hold your own hand, with add-on GC, or RAII and smart-pointers. If there's something you want to accomplish, chances are there's a way to abuse the template system to give you a relatively easy syntax for it. (moreso with C++0x). This complexity also gives you the power to accidentally create a dozen instances of yourself and shoot them all in the foot.

C++ 是添加了类的 C,然后是一大堆其他东西,然后是更多的东西。它不会牵你的手,但它会让你牵自己的手,通过附加的 GC 或 RAII 和智能指针。如果您想完成某件事,那么很可能有一种方法可以滥用模板系统来为您提供相对简单的语法。(还有 C++0x)。这种复杂性还使您能够意外地创建十几个自己的实例并将它们全部射中。

C# is Microsoft's stab at improving on C++ and Java. Tons of syntactical features, but no where near the complexity of C++. It runs in a full managed environment, so memory management is done for you. It does let you "get dirty" and use unsafe code if you need to, but it's not the default, and you have to do some work to shoot yourself.

C# 是微软在 C++ 和 Java 上的改进。大量的语法特征,但远不及 C++ 的复杂性。它在完全托管的环境中运行,因此内存管理已为您完成。如果需要,它确实会让你“变脏”并使用不安全的代码,但这不是默认的,你必须做一些工作来拍摄自己。

回答by Robert Paulson

My opinion is C# and ASP.NET would be the best of the three for development that is web biased.

我的观点是 C# 和 ASP.NET 将是三者中最好的,以进行偏向网络的开发。

I doubt anyone writes new web apps in C or C++ anymore. It was done 10 years ago, and there's likely a lot of legacy code still in use, but they're not particularly well suited, there doesn't appear to be as much (ongoing) tool support, and they probably have a small active community that does web development (except perhaps for web server development). I wrote many website C++ COM objects back in the day, but C# is far more productive that there's no compelling reason to code C or C++ (in this context) unless you need to.

我怀疑任何人都不再用 C 或 C++ 编写新的网络应用程序了。它是 10 年前完成的,可能还有很多遗留代码仍在使用,但它们不是特别适合,似乎没有那么多(正在进行的)工具支持,而且它们可能有一个小的活动进行 Web 开发的社区(可能除了 Web 服务器开发)。当时我写了很多网站 C++ COM 对象,但 C# 的效率要高得多,除非你需要,否则没有令人信服的理由来编码 C 或 C++(在这种情况下)。

I do still write C++ if necessary, but it's typically for a small problem domain. e.g. communicating from C# via P/Invoke to old C-style dll's - doing some things that are downright clumsy in C# were a breeze to create a C++ COM object as a bridge.

如有必要,我仍然会编写 C++,但它通常用于小问题域。例如,通过 P/Invoke 从 C# 到旧的 C 风格的 dll 进行通信——在 C# 中做一些非常笨拙的事情对于创建 C++ COM 对象作为桥梁来说是轻而易举的。

The nice thing with C# is that you can also easily transfer into writing Windows and Console apps and stay in C#. With Mono you're also not limited to Windows (although you may be limited to which libraries you use).

使用 C# 的好处是,您还可以轻松转换为编写 Windows 和控制台应用程序并继续使用 C#。使用 Mono,您也不仅限于 Windows(尽管您可能仅限于使用的库)。

Anyways this is all from a web-biased perspective. If you asked about embedded devices I'd say C or C++. You could argue none of these are suited for web development, but C#/ASP.NET is pretty slick, it works well, there are heaps of online resources, a huge community, and free dev tools.

无论如何,这都是从偏向网络的角度来看的。如果你问到嵌入式设备,我会说 C 或 C++。您可能会争辩说这些都不适合 Web 开发,但 C#/ASP.NET 非常灵活,运行良好,有大量的在线资源、庞大的社区和免费的开发工具。

So from a real-world perspective, picking only one of C#, C++ and C as requested, as a general rule, you're better to stick with C#.

因此,从现实世界的角度来看,根据要求仅选择 C#、C++ 和 C 之一,作为一般规则,您最好坚持使用 C#。

回答by Daniel Earwicker

Bear in mind that I speak ASFAC++B. :) I've put the most important differentiating factor first.

请记住,我说的是ASFAC++B。:) 我把最重要的区别因素放在第一位。

Garbage Collection

垃圾收集

Garbage Collection (GC) is the single most important factor in differentiating between these languages.

垃圾收集 (GC) 是区分这些语言的一个最重要的因素。

While C and C++ can be used with GC, it is a bolted-on afterthought and cannot be made to work as well (the best known is here) - it has to be "conservative" which means that it cannot collect all unused memory.

虽然 C 和 C++ 可以与 GC 一起使用,但它是事后的想法,不能很好地工作(最著名的是这里) - 它必须是“保守的”,这意味着它不能收集所有未使用的内存。

C# is designed from the ground up to work on a GC platform, with standard libraries also designed that way. It makes an absolutely fundamental difference to developer productivity that has to be experienced to be believed.

C# 从头开始​​设计用于在 GC 平台上工作,标准库也以这种方式设计。它对开发人员的生产力产生了绝对根本的影响,必须经历才能相信。

There is a belief widespread among C/C++ users that GC equates with "bad performance". But this is out-of-date folklore (even the Boehm collector on C/C++ performs much better than most people expect it to). The typical fear is of "long pauses" where the program stops so the GC can do some work. But in reality these long pauses happen with non-GC programs, because they run on top of a virtual memory system, which occasionally interrupts to move data between physical memory and disk.

C/C++ 用户普遍认为 GC 等同于“性能不佳”。但这是过时的民间传说(即使是 C/C++ 上的 Boehm 收集器的性能也比大多数人预期的要好得多)。典型的恐惧是程序停止时的“长时间停顿”,以便 GC 可以做一些工作。但实际上,这些长时间的停顿发生在非 GC 程序上,因为它们运行在虚拟内存系统之上,该系统偶尔会中断以在物理内存和磁盘之间移动数据。

There is also widespread belief that GC can be replaced with shared_ptr, but it can't; the irony is that in a multi-threaded program, shared_ptris slower than a GC-based system.

人们也普遍认为 GC 可以用shared_ptr代替,但它不能;具有讽刺意味的是,在多线程程序中,shared_ptr比基于 GC 的系统慢。

There are environments that are so frugal that GC isn't practical - but these are increasingly rare. Cell phones typically have GC. The CLR's GC that C# typically runs on appears to be state-of-the-art.

有些环境非常节俭,以至于 GC 不实用 - 但这些环境越来越少。手机通常具有GC。C# 通常运行的 CLR 的 GC 似乎是最先进的。

Since adopting C# about 18 months ago I've gone through several phases of pure performance tuning with a profiler, and the GC is so efficient that it is practically invisible during the operation of the program.

自从大约 18 个月前采用 C# 以来,我已经通过分析器经历了几个纯粹的性能调优阶段,而且 GC 非常高效,以至于在程序运行过程中几乎不可见。

GC is not a panacea, it doesn't solve all programming problems, it only really cleans up memory allocation, if you're allocating very large memory blocks then you will still need to take some care, and it is still possible to have what amounts to a memory leak in a sufficiently complex program - and yet, the effect of GC on productivity makes it a pretty close approximation to a panacea!

GC 不是灵丹妙药,它不能解决所有的编程问题,它只是真正清理内存分配,如果你正在分配非常大的内存块,那么你仍然需要小心,仍然有可能有什么相当于一个足够复杂的程序中的内存泄漏 - 然而,GC 对生产力的影响使它非常接近万能药!

Undefined Behaviour

未定义的行为

C++ is founded on the notion of undefined behaviour. That is, the language specification defines the outcome of certain narrowly defined usages of language features, and describes all other usages as causing undefined behaviour, meaning in principle that the operation could have any outcome at all (in practice this means hard-to-diagnose bugs involving apparently non-deterministic corruption of data).

C++ 建立在未定义行为的概念之上。也就是说,语言规范定义了语言特性的某些狭义用法的结果,并将所有其他用法描述为导致未定义行为,这意味着原则上该操作可能会产生任何结果(实际上这意味着难以诊断)涉及明显非确定性数据损坏的错误)。

Almost everything about C++ touches on undefined behaviour. Even very nice forthcoming features like lambda expressions can easily be used as convenient way to corrupt the stack (capture a local by reference, allow the lambda instance to outlive the local).

几乎所有关于 C++ 的内容都涉及未定义的行为。即使是非常好的即将推出的功能,如 lambda 表达式,也可以很容易地用作破坏堆栈的便捷方式(通过引用捕获本地,允许 lambda 实例比本地更长)。

C# is founded on the principle that all possible operations should have defined behaviour. The worst that can happen is an exception is thrown. This completely changes the experience of software construction.

C# 建立在所有可能的操作都应该具有定义的行为的原则之上。可能发生的最坏情况是抛出异常。这完全改变了软件构建的体验。

(There's unsafe mode, which has pointers and therefore undefined behaviour, but that is strongly discouraged for general use - think of it as analogous to embedded assembly language.)

(有不安全模式,它具有指针,因此具有未定义的行为,但强烈建议不要用于一般用途 - 将其视为类似于嵌入式汇编语言。)

Complexity

复杂

In terms of complexity, C++ has to be singled out, especially if we consider the very-soon-to-be standardized new version. C++ does absolutely everything it can to make itself effective, short of assuming GC, and as a result it has an awesome learning curve. The language designers excuse much of this by saying "Those features are only for library authors, not ordinary users" - but to be truly effective in any language, you need to build your code as reusable libraries. So you can't escape.

在复杂性方面,C++ 必须被挑出来,特别是如果我们考虑到即将被标准化的新版本。C++ 尽其所能使自己有效,没有假设 GC,因此它有一个很棒的学习曲线。语言设计者通过说“这些功能仅适用于库作者,而不是普通用户”来原谅这一点 - 但要在任何语言中真正有效,您需要将代码构建为可重用的库。所以你逃不掉。

On the positive side, C++ is so complex, it's like a playground for nerds! I can assure you that you would have a lot of fun learning how it all fits together. But I can't seriously recommend it as a basis for productive new work (oh, the wasted years...) on mainstream platforms.

从积极的方面来说,C++ 是如此复杂,它就像是书呆子的游乐场!我可以向您保证,您会在学习如何将它们组合在一起时获得很多乐趣。但我不能认真推荐它作为主流平台上富有成效的新工作(哦,浪费的岁月......)的基础。

C keeps the language simple (simple in the sense of "the compiler is easy to write"), but this makes the coding techniques more arcane.

C 使语言保持简单(从“编译器易于编写”的意义上说是简单的),但这使得编码技术更加神秘。

Note that not all new language features equate with added complexity. Some language features are described as "syntactic sugar", because they are shorthand that the compiler expands for you. This is a good way to think of a great deal of the enhancements to C# over recent years. The language standard even specifies some features by giving the translation to longhand, e.g. usingstatement expands into try/finally.

请注意,并非所有新语言功能都等同于增加的复杂性。某些语言功能被描述为“语法糖”,因为它们是编译器为您扩展的速记。这是考虑近年来 C# 的大量增强的好方法。语言标准甚至通过将翻译提供为普通来指定一些功能,例如using语句扩展为try/ finally

At one point, it was possible to think of C++ templates in the same way. But they've since become so powerful that they are now form the basis of a whole separate dimension of the language, with its own enthusiastic user communities and idioms.

在某一时刻,有可能以同样的方式思考 C++ 模板。但它们已经变得如此强大,以至于它们现在形成了语言的一个完整独立维度的基础,拥有自己热情的用户社区和习语

Libraries

图书馆

The strangest thing about C and C++ is that they don't have a standard interchangeable form of pre-compiled library. Integrating someone else's code into your project is always a little fiddly, with obscure decisions to be made about how you'll be linking to it.

C 和 C++ 最奇怪的是它们没有标准的可互换形式的预编译库。将其他人的代码集成到您的项目中总是有点繁琐,需要做出关于如何链接到它的模糊决定。

Also, the standard library is extremely basic - C++ has a complete set of data structures and a way of representing strings (std::string), but that's still minimal. Is there a standard way of finding a list of files in a directory? Amazingly, no! Is there standard library support for parsing or generating XML? No. What about accessing databases? Be serious! Writing a web site back-end? Are you crazy? etc.

此外,标准库非常基础——C++ 有一套完整的数据结构和一种表示字符串的方式 ( std::string),但这仍然是最少的。是否有在目录中查找文件列表的标准方法?令人惊讶的是,没有!是否有用于解析或生成 XML 的标准库支持?不。访问数据库怎么样?严肃点!写一个网站后端?你疯了?等等。

So you have to go hunting further afield. For XML, try Xerces. But does it use std::stringto represent strings? Of course not!

所以你必须去更远的地方打猎。对于 XML,请尝试Xerces。但是它是std::string用来表示字符串的吗?当然不是!

And do all these third-party libraries have their own bizarre customs for naming classes and functions? You betcha!

并且所有这些第三方库在命名类和函数方面都有自己的奇葩习惯吗?完全正确!

The situation in C# couldn't be more different; the fundamentals were in place from the start, so everything inter-operates beautifully (and because the fundamentals are supplied by the CLR, there is cross-language support).

C# 中的情况大不相同;基础知识从一开始就到位,所以一切都可以很好地互操作(并且因为基础知识是由 CLR 提供的,所以有跨语言支持)。

It's not all perfect; generics should have been in place from the start but wasn't, which does leave a visible scar on some older libraries; but it is usually trivial to fix this externally. Also a number of popular libraries are ported from Java, which isn't as good a fit as it first appears.

这并不完美;泛型应该从一开始就到位,但没有,这确实在一些较旧的库上留下了明显的疤痕;但是从外部解决这个问题通常是微不足道的。还有一些流行的库是从 Java 移植过来的,这并不像最初出现的那样合适。

Closures (Anonymous Methods with Local Variable Capture)

闭包(具有局部变量捕获的匿名方法)

Java and C are practically the last remaining mainstream languages to lack closures, and libraries can be designed and used much more neatly with them than without (this is one reason why ported Java libraries sometimes seem clunky to a C#?user).

Java 和 C 实际上是最后剩下的缺少闭包的主流语言,并且与没有闭包相比,可以更巧妙地设计和使用库(这就是为什么移植的 Java 库有时对 C# 用户来说显得笨拙的原因之一?)。

The amusing thing about C++ is that its standard library was designed as if closures were available in the language (container types, <algorithm>, <functional>). Then ten years went by, and now they're finally being added! They will have a huge impact (although, as noted above, they leak underfined behaviour).

C++ 的有趣之处在于,它的标准库被设计为好像在语言中可以使用闭包(容器类型,<algorithm>, <functional>)。然后十年过去了,现在他们终于加入了!它们将产生巨大的影响(尽管如上所述,它们会泄露未定义的行为)。

C# and JavaScript are the most widely used languages in which closures are "idiomatically established". (The major difference between those languages being that C# is statically typed while JavaScript is dynamically typed).

C# 和 JavaScript 是使用最广泛的语言,其中闭包是“惯用的”。(这些语言之间的主要区别在于 C# 是静态类型的,而 JavaScript 是动态类型的)。

Platform Support

平台支持

I've put this last only because it doesn't appear to differentiate these languages as much as you might think. All these languages can run on multiple OSes and machine architectures. C is the most widely-supported, then C++, and finally C# (although C# can be used on most major platforms thanks to an open source implementation called Mono).

我把它放在最后只是因为它似乎并没有像你想象的那样区分这些语言。所有这些语言都可以在多个操作系统和机器架构上运行。C 是最受广泛支持的,然后是 C++,最后是 C#(尽管 C# 可以在大多数主要平台上使用,这要归功于名为Mono 的开源实现)。

My experience of porting C++ programs between Windows and various Unix flavours was unpleasant. I've never tried porting anything very complex in C# to Mono, so I can't comment on that.

我在 Windows 和各种 Unix 风格之间移植 C++ 程序的经历很不愉快。我从未尝试将 C# 中任何非常复杂的东西移植到 Mono,所以我无法对此发表评论。

回答by Anand Kuma Arya

C - an older programming language that is described as Hands-on. As the programmer you must tell the program to do everything. Also this language will let you do almost anything. It does not support object orriented code. Thus no classes.

C - 一种较旧的编程语言,被描述为 Hands-on。作为程序员,您必须告诉程序做所有事情。此外,这种语言几乎可以让您做任何事情。它不支持面向对象的代码。因此没有课。

C++ - an extention language per se of C. In C code ++ means increment 1. Thus C++ is better than C. It allows for highly controlled object orriented code. Once again a very hands on language that goes into MUCH detail.

C++ - C 本身的扩展语言。在 C 代码中,++ 表示增量 1。因此 C++ 比 C 更好。它允许高度受控的面向对象代码。再次是一种非常实用的语言,其中涉及很多细节。

C# - Full object orriented code resembling the style of C/C++ code. This is really closer to JAVA. C# is the latest version of the C style languages and is very good for developing web applications.

C# - 完整的面向对象代码,类似于 C/C++ 代码的风格。这确实更接近JAVA。C# 是 C 风格语言的最新版本,非常适合开发 Web 应用程序。

回答by MikeZ

C is the core language that most closely resembles and directly translates into CPU machine code. CPUs follow instructions that move, add, logically combine, compare, jump, push and pop. C does exactly this using much easier syntax. If you study the disassembly, you can learn to write C code that is just as fast and compact as assembly. It is my preferred language on 8 bit micro controllers with limited memory. If you write a large PC program in C you will get into trouble because of its limited organization. That is where object oriented programming becomes powerful. The ability of C++ and C# classes to contain data and functions together enforces organization which in turn allows more complex operability over C. C++ was essential for quick processing in the past when CPUs only had one core. I am beginning to learn C# now. Its class only structure appears to enforce a higher degree of organization than C++ which should ultimately lead to faster development and promote code sharing. C# is not interpreted like VB. It is partially compiled at development time and then further translated at run time to become more platform friendly.

C 是最接近并直接翻译成 CPU 机器码的核心语言。CPU 遵循移动、添加、逻辑组合、比较、跳转、推送和弹出的指令。C 使用更简单的语法来做到这一点。如果您学习反汇编,您可以学习编写与汇编一样快速和紧凑的 C 代码。这是我在内存有限的 8 位微控制器上的首选语言。如果你用 C 编写一个大型 PC 程序,你会因为它的组织有限而陷入困境。这就是面向对象编程变得强大的地方。C++ 和 C# 类一起包含数据和函数的能力加强了组织,这反过来又允许比 C 更复杂的可操作性。在过去,当 CPU 只有一个内核时,C++ 对于快速处理至关重要。我现在开始学习 C#。它的仅类结构似乎比 C++ 强制执行更高程度的组织,这最终会导致更快的开发并促进代码共享。C# 不像 VB 那样被解释。它在开发时被部分编译,然后在运行时进一步翻译以变得更加平台友好。