C ++来自Java和Objective-C [英] C++ coming from Java and Objective-C

查看:138
本文介绍了C ++来自Java和Objective-C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我知道Java和Objective-C都很好,但(可能奇怪)从来没有真正学会C ++。显然,语言都是相关的,但有语法上的差异,我不完全理解。是否有一个很好的文档描述了C ++的基础知识,但仍然假设学习者知道一种编程语言?也许甚至一个教程,旨在描述语言之间的差异。这是我正在寻找。

So, I know both Java and Objective-C quite well, but (perhaps strangely) never really learned C++. Obviously, the languages are all related, but there are syntactical differences that I don't fully understand. Is there a nice document that describes the basics of C++, but still assumes the learner knows a programming language? Perhaps even a tutorial that aims to describe the differences between the languages. This is what I'm looking for.

此外,有一个很好的教程如何使用C ++代码在Mac或iOS应用程序?我觉得需要学习C ++的原因是我想要移植一个C ++程序,我听说你可以使用C ++代码,只是将它包装在一个Obj-C GUI。

Also, is there a good tutorial on how to use C++ code inside a Mac or iOS app? The reason I feel the need to learn C++ is I'm trying to port a C++ program, and I heard you can use C++ code and just wrap it in an Obj-C GUI. Could someone point me to some documentation/tutorials on how to do this?

谢谢!

推荐答案

即使这个家族的语言都是相关的,这并不意味着你可以随意地从一个移动到另一个,期望写出漂亮的代码。

Even though the languages of this family are all related, that does not mean that you can casually move from one to the other and expect to write beautiful code. You have to learn the language's idioms and idiosyncrasies, and experience its strengths and way of thinking.

我会推荐阅读Stroustrup的原着书(当然是一本现代版本)。你必须学习语言的习语和特质,并体验它的优势和思维方式。它是最确切的参考(短于实际标准),它很清楚地写。这种方法的好处是,你将被教授我将如何在C ++中这样做,而不是如何音译这段Java代码来使其编译。 (也是这种方法消除了你可能有的任何风险,认为你应该学习C第一。不要。)

I would recommend reading Stroustrup's original book (a modern edition, of course). It's the most definitive reference (short of the actual standard) and it is very clearly written. The benefit of this approach is that you will be taught to think "how would I do this in C++", rather than "how do I transliterate this piece of Java code to make it compile". (Also this approach does away with any risk you might have of thinking you should "learn C first". Don't.)

MacOSX,下载并构建免费的GCC,或获得XCode(与GCC一起)。对于iOS我不知道,我怀疑你不能部署本地代码。

On MacOSX, either download and build the free GCC, or get XCode (which comes with GCC). For iOS I don't know, I have a suspicion that you cannot deploy native code on it.

这篇关于C ++来自Java和Objective-C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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