本文介绍了C ++新手,帮助我入门的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名Java程序员,有一点C知识谁想要开始使用C ++可以有人推荐一个好的教程吗?

Im a Java programmer, with a little C knowledge who wants to get started with with C++ can someone recommend a good tutorial?

也有任何帮助:


  • 要学习的项目

  • 推荐阅读

  • 什么是IDE ?我目前使用NetBeans

  • 一般C ++建议

  • projects to learn with
  • recommended reading
  • what IDE ? I currently use NetBeans
  • general C++ advice

推荐答案

取决于您的目标平台,我使用Visual Studio作为IDE。

Depends on your target platform, I use Visual Studio as an IDE.

与Java相比,C ++的一般规则是它包含比Java更多的自由,特别是关于模板与泛型,堆栈与堆,以及面向对象的强制执行(或缺乏)及其原则。例如,C ++提供了封装破坏的友元语句,const_cast,在堆栈上分配对象,指针可以指向它们,模板具有比泛型更多的功能等。

The general rule of C++ as opposed to Java is that it contains a hell of a lot more freedom than Java, especially as regards to templates vs generics, the stack vs the heap, and the enforcement (or lack thereof) of object orientation and it's principles. For example, C++ provides the encapsulation-breaking friend statement, the const_cast, allocates objects on the stack and pointers can point to them, templates have infinitely more power than generics, etc.

您必须习惯的另一个主要问题是资源管理。 C ++不提供GC。您将需要熟悉RAII(资源获取是初始化)以及基于范围的构造和破坏如何工作以避免资源泄漏。

The other main thing you will have to get used to is resource management. C++ does not provide a GC. You will need to familiarize yourself with RAII (resource acquisition is initialization) and how scope-based construction and destruction work to avoid resource leaks.

您还需要刷新在标准模板库(STL)上。 STL具有比Java库更直接的方法 - 例如,std :: iostream类提供从文件中提取浮点数,字符串等的本机方法,而在Java中,您需要文件和扫描程序,尽管它是范围更加有限 - 没有基于GUI或基于目录的组件,仅适用于初学者。

You will also need to brush up on the Standard Template Library (STL). The STL has a much more directed approach than the Java libraries- for example, the std::iostream class provides native methods to extract floats, strings, etc from the file, whereas in Java you need both a File and a Scanner, although it's scope is far more limited- no GUI or directory-based components, just for starters.

哦,顺便说一句,严肃地说,放弃你的C知识。它会伤害而不是帮助你。

Oh, by the way, seriously, ditch your C knowledge. It'll hurt rather than help you.

这篇关于C ++新手,帮助我入门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 15:29