Title: C++ vs. Objective C
Entry Number: 2589
Creation Date: January 27, 1998

….Overview
….Benefits of C++
….Benefits of Objective C
….An Objective C Primer

Overview

“I already know C++. Why do I have to learn Objective C?”
나는 이미 C++을 알고있습니다. 왜 Objective C를 배워야 하나요?

Objective C and C++ are different in their design and intent. C++ extends and modifies C significantly to create a new object-oriented language. The complexity of these changes sometimes leads to confusing interactions between features. Learning C++ can be a lengthy process, and without a stable standard, differences between C++ compilers can add to the confusion.
Objective C 와 C++ 은 설계(디자인)의 관점이 다릅니다. C++의 확장과 C에서의 중요한 변경점은 새로운 객체지향 언어를 만들기 위함에 목적이 있습니다. 변경된 부분들에 대한 복잡함은 때로는 기능간의 상호작용을 복잡하게 합니다.
C++을 배우는 것에는 긴과정, 배제되는 안정적표준, C++컴파일러와의 차이에서 오는 혼동이 동반됩니다.

Objective C is a set of simple extensions that provide ANSI C (or C++) with a simple but powerful standard object model. Most C programmers will be able to learn enough Objective C for most applications in a few days.
ObjectiveC는 ANSI C 표준에 간단하지만 강력한 표준객체모델을 추가한 간단한 확장을 구현하였습니다. 대부분의 C프로그래머는 Objective C로 어플리케이션을 작업하는 방법을 배우는데 적은 기간안에 학습이 가능합니다.

Because of this difference in design philosophy, each language has its own benefits and limitations. OPENSTEP’s development tools give you the widest range of possibilities by allowing C programmers to write object-oriented code quickly with Objective C, while allowing C++ programmers to mix Objective C and C++ in their projects. Because of its simplicity, Objective C does lack some features that C++ provides; however, most of C++’s functionality can be accessed in other ways in Objective C. OPENSTEP also allows you to use all of the features of C++ by including native C++ objects in your OPENSTEP programming projects.
이것이 바로 디자인 철학의 차이때문입니다. 각각의 언어(computer language)는 이점과 한계를 동시에 가지고 있습니다. OPENSTEP의 개발도구는 C프로그래머가 Objective C로 객체지향코드를 작성하는 경우에  C++프로그래머가 Objective C 그리고 C++을 사용해서 프로그래밍하는 경우보다 넓은범위의 가능성을 제공합니다.
이건 아주 단순합니다. Objective C가 c++구현에서 몇가지 부족하다고 여겨지는 것들을 구현했기 때문입니다.
하지만 대부분의 c++함수들은 Objective C를 이용할 수 있는 방법을들 가지고 있습니다.
OPENSTEP은 당신의 OPENSTEP프로그래밍 프로젝트에서 native C++ 객체를 포함해서 C++를 사용할 수 있는 방법을 제공합니다.

Benefits of C++
C++의 이점

Some of the unique features of C++ are:
C++만이 가지고있는 몇가지 고유특성

+ Multiple inheritance
+ 다중상속

Objective C, like Java, does not support multiple inheritance. Instead, it allows the user to define a protocol. Declaring an Objective C class to conform to a protocol is similar to declaring a Java class to implement an interface; it defines a standard set of methods (member functions) that the class must respond to. Another object can check at runtime to see if a particular class conforms to a particular protocol. Thus, Boat would be a subclass of Vehicle and Duck would be a subclass of bird, and both would conform to the FloatingThings protocol. Unlike with multiple inheritance, only method declarations (member function declarations) are included, not definitions or instance variables (data members). Alternatively, the dynamic nature of Objective C allows you to simulate multiple inheritance: see NeXTAnswer # 2567.

Objective C는 자바와 비슷하지만 다중상속을 지원하지 않습니다.
반면에, 사용자가 프로토콜을 정의할 수 있도록합니다. 
프로토콜을 따르는 Objective C 클래스를 선언하는 것은 interface를 따르는 Java 클래스를 선언하는 것과 유사합니다. 
이것(프로토콜을 따르는 Objective C 클래스를 선언)은 클래스에서 반응해야 하는 메소드들(멤버 함수들)의 표준을 정의합니다. 
다른 객체는 특정프로토콜이 특정클래스를 준수하는지 (프로그램)실행중에 확인해 볼 수 있습니다.
따라서 Boat는 Vehicle의 하위 클래스가 되고 Duck은 bird의 하위 클래스가 되며, 두가지 각각의 경우는 FloatingThings 프로토콜을 따릅니다. 
다중 상속과는 다르게, Method 선언 (멤버 함수 선언) 만이 포함될 수 있으며, 정의외 인스턴스 변수(데이터 멤버)는 포함되지 않습니다. 
대신, Objective C의 동적 특성은 다중 상속과 유사한 동작을 할 수 있도록 합니다. NeXTAnswer # 2567를 참조하십시오.

+ A friend-ly language
친숙한 Language

C++ gives finer access control over all of an object’s elements than Objective C, with private, public, and protected keywords and the concept of friend functions. Objective C does allow instance variables (data members) to be set as public, private, or protected, but does not have an equivalent construct for methods (member functions).
C++은 Private, public,  protected keywords와 friend functions을 포함한 모든 Objective C의 구성요소에 대한 월등한 접근 제어를 제공합니다.
Objective C는 public, private, 또는 protected로 선언된 인스턴스변수(데이터 멤버)를 허용합니다.  하지만 Method(멤버함수)를 구성하는 동일한 방법을 제공하는것은 아닙니다.

+ iostream.h

C++ provides a new implementation of the ANSI input/output library for stream-based i/o. Objective C does not have an analogous library, but some implementations of Objective C++ do allow you to call the C++ iostream library from your Objective C++ projects.
C++은 스트림 기반의 i/o를 위한 ANSI 입력/출력을 이용한 새로운 구현방법을 제공합니다.
Objective C는  비슷한 라이브러리를 가지고 있지 않습니다. 하지만 Objective C++의 몇가지 구현은 당신의 Objective C++ 프로젝트에서 c++ io스트림을 사용할 수 있게 해줍니다.

Benefits of Objective C
Objective C의 장점

+ Dynamic typing and the id type
+ 동적 타입 및 id타입

Any variable in an Objective C object may be declared as type id, meaning a pointer to an object of an undetermined type. The type can be determined at run time, and the appropriate messages sent. Using Objective C’s SEL type, you can determine at runtime which message is sent to the object, and therefore what method (member function) is accessed. To avoid runtime problems, the programmer can also test at runtime (with the respondsToSelector: method) to see which messages an object recognizes. Class methods (static member functions) are also available; unlike C++ classes, Objective C classes are true objects and exist at runtime.
Objective C의 객체의 어떤 변수든지 확실히 정의되지 않은 유형의 객체포인터를 의미하는 “id 형”으로 선언될 수 있습니다.  Type(형)은 실행될때에 결정될 수 있습니다. 그리고 적당한 메세지를 보내는거죠.  Objective C’s SEL 타입을 사용하려면 실행 시점에서 어떤 메세지를 객체에 보내고 Method(멤버함수)에 엑세스하면 됩니다.  실행시 문제는 프로그래머가 실행시점(respondsToSelector: method를 포함하는)에서 객체에게 어떤메세지를 보내서 제대로 작동되는지를 테스트를 한다면 방지할 수 있습니다.
클래스의 Methods(정적 멤버함수)라면 가능합니다. C++ 클래스와는 다르게 Objective C 클래스는 실행시에(동적타입이 지원되는) “진정한(제대로 구현된)” 객체입니다.

+ Categories and dynamic loading
+ 카테고리와 동적로딩

The dynamic nature of Objective C allows existing classes to be extended at runtime. Objective C allows you to define categories, related sets of extensions to objects you’ve already created. For example, in converting a text-based app into a graphics app, the code your objects needed to draw themselves could be compiled as a category and loaded at run-time only when needed. This saves memory and allows you to leave your original objects unmodified.
Objective C의 동적인 특성은 실행시의 모든 객체애 대한 확장을 허용합니다. ObjectiveC는 당신의 카테고리를 정의하며 관련되어 생성되어있던 객체의 확장을 정의하고 허용합니다. 예를 들자면 텍스트 기반의 어플을 그래픽어플로 전환하려 할때, 객체들이 그들 자신을 가져올 필요가 있는 코드는 카테고리처럼 컴파일 될 수 있으며  필요에 따라 실행시간에만 로드 됩니다.. 이것은 메모리 절약과 원래의 객체가 수정되지 않은 상태에서 떠나는것을 허용합니다.

+ Simple and standard
+ 간단함 그리고 표준적

C++ is a complex and evolving language, leading to differences between compilers and implementations; as a result, C++ users need to be more careful about using features like boolean types that may not be supported on all compilers. Objective C ‘s simplicity makes these problems less likely; it has also helped it maintain a stable standard. (And yes, Objective C does have a BOOL data type.)
c++은 진화하는 언어이며 복잡합니다. 다른 컴파일러마다 다르게 선언되어있는것을 학습해야합니다. 결과적으로 C++사용자는 boolean 형식과 같은 기능을 사용하는 방법에 대해 모든 컴파일러에서 지원되지 않을수도 있으니 신중해야 합니다.
Objective C는 단순하기 때문에 문제가 있을 가능성이 상당이 적습니다. 이것은 안정적인 유지보수를 도와주게됩니다. (그리고 Objective C는 BOOL데이터 타입을 가지고있죠)

+ Shortcuts

C++ doesn’t have a monopoly on convenient features, either. Objective C’s additions include C++-style // comments and the #import directive, which acts like the #include directive but insures that each referenced file is included only once per project.
C++은 편리한 기능을 독점하지 않고 있습니다. 하지만 Objective C는 c++스타일을 포함하고 있습니다. // 코멘트와 #include 지시자와 비슷하지만 참조된 파일을 포르젝트마다 한번만 포함해서 처리하는 #import 지시자등이 있습니다.

An Objective C Primer
Objective C 기초

A C++ programmer who starts working in Objective C is likely to notice the differences in syntax before the more subtle differences in implementation. For example, a call to a C++ Employee class instance’s promoteToManager member function might look like this:
C++프로그래머는 Objective C로 일을 시작하는 경우 구현하는 문법의 이전과 다른 세세한 차이점들을 보면 비슷하게 느낄 수 있습니다. 예를 들자면 C++ Employee의 인스턴스로 promoteToManager 멤버함수를 참조하는 법을 보겠습니다.

anEmployee.promoteToManager();

In Objective C, this same call would look like this:
ObjectiveC의 경우는 위의 동작을 이렇게 구현합니다.

[anEmployee promoteToManager];

A similar call with two arguments in C++…
2개의 인수를 받는 경우에 C++은 이렇습니다.

anEmployee.promote(newPosition, newSalary);

…would look like this in Objective C:
ObjectiveC는 이렇게 구현합니다.

[anEmployee promoteToPosition:newPosition atSalary:newSalary];

Here, the member function being called (in Objective C terminology, the instance method being messaged) is called promoteToPosition:atSalary:
여기보자. 호출되는 멤버함수는 (Objective C 용어로는, 인스턴스 메서드가 메세지를 받는다고 한다) promoteToPosition:atSalary: 라고 한다.
Objective C’s syntax and naming conventions are discussed in more detail in the book Object-Oriented Programming and the Objective C Language. This book also contains information on combining Objective C and C++ code in OPENSTEP projects and goes into more detail on the principles behind Objective C’s object model. It is available as part of OpenStep’s online documentation, or printed copies can be purchased from Apple Enterprise Software. More information, including a link to the Objective C Usenet FAQ, is available from the GNU Objective-C Project at http://world.std.com/~gsk/gnu-objc.html.

Objective C의 문법과 이름규칙은 Object-Oriented Programming and the Objective C Language 책에서 자세히 설명하겠습니다.
이책은 OPENSTEP 프로젝트에서 Objective C and C++ 코드를 결합시키는것에 대한 정보와 Objective C의 객체 모델에 감춰진 원칙등에 대한 자세한 정보를 포함하고 있습니다.
이건  OpenStep’s online documentation의 일부로서 Apple Enterprise Software에서 인쇄본을 구매할 수 있습니다.
좀 더 자세한 정보는 Objective C Usenet FAQ line에 포함되어 있으며 http://world.std.com/~gsk/gnu-objc.html(지금은 문서가 없어요:역자주) 문서의 GNU Objective-C Project에서 찾을 수 있습니다.

이 문서는 Darkcircle, arvid, neogeo님의 도움으로 번역되었습니다.