什么是C和C之间的主要区别++时,你会选择一个比其他? [英] What are the major differences between C and C++ and when would you choose one over the other?

查看:181
本文介绍了什么是C和C之间的主要区别++时,你会选择一个比其他?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于那些与既有经验,有什么主要区别?对于一个初来乍到要么,这将是更好地学习?在那里,你会选择C ++情况下,您可以选择C,但随后其他情况?它是使用的情况下作业的最佳工具或者一个比另一个更显著。我知道C ++是一个的C强化,但它是在'83创建并没有完全取代Ç所以必须有它更多的东西。

For those of you with experience with both, what are the major differences? For a newcomer to either, which would be better to learn? Are there situations where you might choose C but then other situations where you would choose C++? Is it a case of use the best tool for the job or one is significantly better than the other. I know C++ is an "enhancement" of C, but it was created in '83 and hasn't completely replaced C so there must be something more to it.

我知道这个问题是主观的,我不是要启动任何宗教战争,所以请尽量尽可能客观。清除的长处和短处和比较。

I know this question is subjective and I am not trying to start any religious war, so please try to be as objective as possible. Clear strengths and weaknesses and comparisons.

推荐答案

虽然C是一种纯粹的过程语言,C ++是一个的多范式的语言。它支持

While C is a pure procedural language, C++ is a multi-paradigm language. It supports


  • 泛型编程:允许写code一次,并用不同的数据结构使用它

  • 元编程:允许利用模板在编译时生成高效code

  • 检查:允许检查在编译时某些属性:没有一个前pression有哪些类型?多少个参数做了功能有哪些?每个特性有哪些类型?

  • 面向对象程序设计:允许程序员在程序面向对象的,具有先进的功能,如多重继承和私有继承。

  • 程序编程:允许程序员将没有任何类别的功能。具有先进的功能,如ADL允许写入干净code从某些类别的具体解耦相结合。

除了这些,C ++在很大程度上保持着C code兼容性,但也有一些差异。这些可以在C ++标准的附录D与原因和可能的固定,使C code时有效C ++ code来了解,共同提高。

Apart from those, C++ has largely kept compatibility with C code, but there are some differences. Those can be read about in Annex D of the C++ Standard, together with reasons and possible fixed to make C code valid C++ code.

这篇关于什么是C和C之间的主要区别++时,你会选择一个比其他?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆