New to C++, help me get started(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++ 建议
推荐答案
取决于你的目标平台,我使用 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 中,您需要 File 和 Scanner,尽管它是范围更有限 - 没有 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++ 新手,帮助我开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C++ 新手,帮助我开始


基础教程推荐
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 我有静态或动态 boost 库吗? 2021-01-01
- 这个宏可以转换成函数吗? 2022-01-01
- 常量变量在标题中不起作用 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 在 C++ 中计算滚动/移动平均值 2021-01-01