{"id":83,"date":"2011-10-10T21:08:31","date_gmt":"2011-10-10T12:08:31","guid":{"rendered":"http:\/\/nextstep.onionmixer.net\/wordpress\/?p=83"},"modified":"2011-10-13T16:18:57","modified_gmt":"2011-10-13T07:18:57","slug":"appledata-2591-objective-c-vs-c","status":"publish","type":"post","link":"http:\/\/nextstep.onionmixer.net\/wordpress\/?p=83","title":{"rendered":"NeXTanswers :: 2591 :: Objective C vs C++"},"content":{"rendered":"<p><strong>Title:<\/strong> C++ vs. Objective C<br \/>\n<strong>Entry Number: <\/strong>2589<br \/>\n<strong>Creation Date: <\/strong>January 27, 1998<\/p>\n<p>&#8230;.Overview<br \/>\n&#8230;.Benefits of C++<br \/>\n&#8230;.Benefits of Objective C<br \/>\n&#8230;.An Objective C Primer<\/p>\n<p>Overview<\/p>\n<p>&#8220;I already know C++. Why do I have to learn Objective C?&#8221;<br \/>\n\ub098\ub294 \uc774\ubbf8 C++\uc744 \uc54c\uace0\uc788\uc2b5\ub2c8\ub2e4. \uc65c Objective C\ub97c \ubc30\uc6cc\uc57c \ud558\ub098\uc694?<\/p>\n<p>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.<br \/>\n<span style=\"color: #3366ff;\">Objective C \uc640 C++\u00a0\uc740 \uc124\uacc4(\ub514\uc790\uc778)\uc758 \uad00\uc810\uc774 \ub2e4\ub985\ub2c8\ub2e4. C++\uc758 \ud655\uc7a5\uacfc C\uc5d0\uc11c\uc758 \uc911\uc694\ud55c \ubcc0\uacbd\uc810\uc740 \uc0c8\ub85c\uc6b4 \uac1d\uccb4\uc9c0\ud5a5 \uc5b8\uc5b4\ub97c \ub9cc\ub4e4\uae30 \uc704\ud568\uc5d0 \ubaa9\uc801\uc774 \uc788\uc2b5\ub2c8\ub2e4. \ubcc0\uacbd\ub41c \ubd80\ubd84\ub4e4\uc5d0 \ub300\ud55c \ubcf5\uc7a1\ud568\uc740 \ub54c\ub85c\ub294 \uae30\ub2a5\uac04\uc758 \uc0c1\ud638\uc791\uc6a9\uc744 \ubcf5\uc7a1\ud558\uac8c \ud569\ub2c8\ub2e4.<\/span><br \/>\n<span style=\"color: #3366ff;\"> C++\uc744 \ubc30\uc6b0\ub294 \uac83\uc5d0\ub294 \uae34\uacfc\uc815, \ubc30\uc81c\ub418\ub294 \uc548\uc815\uc801\ud45c\uc900, C++\ucef4\ud30c\uc77c\ub7ec\uc640\uc758 \ucc28\uc774\uc5d0\uc11c \uc624\ub294 \ud63c\ub3d9\uc774 \ub3d9\ubc18\ub429\ub2c8\ub2e4.<\/span><\/p>\n<p>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.<br \/>\n<span style=\"color: #3366ff;\">ObjectiveC\ub294 ANSI C \ud45c\uc900\uc5d0 \uac04\ub2e8\ud558\uc9c0\ub9cc \uac15\ub825\ud55c \ud45c\uc900\uac1d\uccb4\ubaa8\ub378\uc744 \ucd94\uac00\ud55c \uac04\ub2e8\ud55c \ud655\uc7a5\uc744 \uad6c\ud604\ud558\uc600\uc2b5\ub2c8\ub2e4. \ub300\ubd80\ubd84\uc758 C\ud504\ub85c\uadf8\ub798\uba38\ub294 Objective C\ub85c \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \uc791\uc5c5\ud558\ub294 \ubc29\ubc95\uc744 \ubc30\uc6b0\ub294\ub370 \uc801\uc740 \uae30\uac04\uc548\uc5d0 \ud559\uc2b5\uc774 \uac00\ub2a5\ud569\ub2c8\ub2e4.<\/span><\/p>\n<p>Because of this difference in design philosophy, each language has its own benefits and limitations. OPENSTEP&#8217;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++&#8217;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.<br \/>\n<span style=\"color: #3366ff;\">\uc774\uac83\uc774 \ubc14\ub85c \ub514\uc790\uc778 \ucca0\ud559\uc758 \ucc28\uc774\ub54c\ubb38\uc785\ub2c8\ub2e4. \uac01\uac01\uc758 \uc5b8\uc5b4(computer language)\ub294 \uc774\uc810\uacfc \ud55c\uacc4\ub97c \ub3d9\uc2dc\uc5d0 \uac00\uc9c0\uace0 \uc788\uc2b5\ub2c8\ub2e4. OPENSTEP\uc758 \uac1c\ubc1c\ub3c4\uad6c\ub294 C\ud504\ub85c\uadf8\ub798\uba38\uac00 Objective C\ub85c \uac1d\uccb4\uc9c0\ud5a5\ucf54\ub4dc\ub97c\u00a0\uc791\uc131\ud558\ub294 \uacbd\uc6b0\uc5d0 \u00a0C++\ud504\ub85c\uadf8\ub798\uba38\uac00 Objective C \uadf8\ub9ac\uace0 C++\uc744 \uc0ac\uc6a9\ud574\uc11c \ud504\ub85c\uadf8\ub798\ubc0d\ud558\ub294 \uacbd\uc6b0\ubcf4\ub2e4 \ub113\uc740\ubc94\uc704\uc758 \uac00\ub2a5\uc131\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4.<\/span><br \/>\n<span style=\"color: #3366ff;\"> \uc774\uac74 \uc544\uc8fc \ub2e8\uc21c\ud569\ub2c8\ub2e4. Objective C\uac00 c++\uad6c\ud604\uc5d0\uc11c \uba87\uac00\uc9c0 \ubd80\uc871\ud558\ub2e4\uace0 \uc5ec\uaca8\uc9c0\ub294 \uac83\ub4e4\uc744 \uad6c\ud604\ud588\uae30 \ub54c\ubb38\uc785\ub2c8\ub2e4.<\/span><br \/>\n<span style=\"color: #3366ff;\"> \ud558\uc9c0\ub9cc \ub300\ubd80\ubd84\uc758 c++\ud568\uc218\ub4e4\uc740 Objective C\ub97c \uc774\uc6a9\ud560 \uc218 \uc788\ub294 \ubc29\ubc95\uc744\ub4e4 \uac00\uc9c0\uace0 \uc788\uc2b5\ub2c8\ub2e4.<\/span><br \/>\n<span style=\"color: #3366ff;\"> OPENSTEP\uc740 \ub2f9\uc2e0\uc758 OPENSTEP\ud504\ub85c\uadf8\ub798\ubc0d \ud504\ub85c\uc81d\ud2b8\uc5d0\uc11c native C++ \uac1d\uccb4\ub97c \ud3ec\ud568\ud574\uc11c C++\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \ubc29\ubc95\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4.<\/span><\/p>\n<p>Benefits of C++<br \/>\nC++\uc758 \uc774\uc810<\/p>\n<p>Some of the unique features of C++ are:<br \/>\n<span style=\"color: #3366ff;\">C++\ub9cc\uc774 \uac00\uc9c0\uace0\uc788\ub294 \uba87\uac00\uc9c0 \uace0\uc720\ud2b9\uc131<\/span><\/p>\n<p>+ Multiple inheritance<br \/>\n+ \ub2e4\uc911\uc0c1\uc18d<\/p>\n<p>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.<\/p>\n<pre><span style=\"color: #3366ff;\">Objective C\ub294 \uc790\ubc14\uc640 \ube44\uc2b7\ud558\uc9c0\ub9cc \ub2e4\uc911\uc0c1\uc18d\uc744 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4.<\/span>\r\n<span style=\"color: #3366ff;\">\ubc18\uba74\uc5d0, \uc0ac\uc6a9\uc790\uac00 \ud504\ub85c\ud1a0\ucf5c\uc744 \uc815\uc758\ud560 \uc218 \uc788\ub3c4\ub85d\ud569\ub2c8\ub2e4. <\/span>\r\n<span style=\"color: #3366ff;\">\ud504\ub85c\ud1a0\ucf5c\uc744 \ub530\ub974\ub294 Objective C \ud074\ub798\uc2a4\ub97c \uc120\uc5b8\ud558\ub294 \uac83\uc740 interface\ub97c \ub530\ub974\ub294 Java \ud074\ub798\uc2a4\ub97c \uc120\uc5b8\ud558\ub294 \uac83\uacfc \uc720\uc0ac\ud569\ub2c8\ub2e4. <\/span>\r\n<span style=\"color: #3366ff;\">\uc774\uac83(\ud504\ub85c\ud1a0\ucf5c\uc744 \ub530\ub974\ub294 Objective C \ud074\ub798\uc2a4\ub97c \uc120\uc5b8)\uc740 \ud074\ub798\uc2a4\uc5d0\uc11c \ubc18\uc751\ud574\uc57c \ud558\ub294 \uba54\uc18c\ub4dc\ub4e4(\uba64\ubc84 \ud568\uc218\ub4e4)\uc758 \ud45c\uc900\uc744 \uc815\uc758\ud569\ub2c8\ub2e4. <\/span>\r\n<span style=\"color: #3366ff;\">\ub2e4\ub978 \uac1d\uccb4\ub294 \ud2b9\uc815\ud504\ub85c\ud1a0\ucf5c\uc774 \ud2b9\uc815\ud074\ub798\uc2a4\ub97c \uc900\uc218\ud558\ub294\uc9c0 (\ud504\ub85c\uadf8\ub7a8)\uc2e4\ud589\uc911\uc5d0 \ud655\uc778\ud574 \ubcfc \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/span>\r\n<span style=\"color: #3366ff;\">\ub530\ub77c\uc11c Boat\ub294 Vehicle\uc758 \ud558\uc704 \ud074\ub798\uc2a4\uac00 \ub418\uace0 Duck\uc740 bird\uc758 \ud558\uc704 \ud074\ub798\uc2a4\uac00 \ub418\uba70, \ub450\uac00\uc9c0 \uac01\uac01\uc758 \uacbd\uc6b0\ub294 FloatingThings \ud504\ub85c\ud1a0\ucf5c\uc744 \ub530\ub985\ub2c8\ub2e4. <\/span>\r\n<span style=\"color: #3366ff;\">\ub2e4\uc911 \uc0c1\uc18d\uacfc\ub294 \ub2e4\ub974\uac8c, Method \uc120\uc5b8 (\uba64\ubc84 \ud568\uc218 \uc120\uc5b8) \ub9cc\uc774 \ud3ec\ud568\ub420 \uc218 \uc788\uc73c\uba70, \uc815\uc758\uc678 \uc778\uc2a4\ud134\uc2a4 \ubcc0\uc218(\ub370\uc774\ud130 \uba64\ubc84)\ub294 \ud3ec\ud568\ub418\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. <\/span>\r\n<span style=\"color: #3366ff;\">\ub300\uc2e0, Objective C\uc758 \ub3d9\uc801 \ud2b9\uc131\uc740 \ub2e4\uc911 \uc0c1\uc18d\uacfc \uc720\uc0ac\ud55c \ub3d9\uc791\uc744 \ud560 \uc218 \uc788\ub3c4\ub85d \ud569\ub2c8\ub2e4. NeXTAnswer # 2567\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624.<\/span><\/pre>\n<pre><\/pre>\n<p>+ A friend-ly language<br \/>\n\uce5c\uc219\ud55c Language<\/p>\n<p>C++ gives finer access control over all of an object&#8217;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).<br \/>\nC++\uc740 Private, public, \u00a0protected keywords\uc640 friend functions\uc744 \ud3ec\ud568\ud55c \ubaa8\ub4e0\u00a0Objective C\uc758 \uad6c\uc131\uc694\uc18c\uc5d0 \ub300\ud55c \uc6d4\ub4f1\ud55c \uc811\uadfc \uc81c\uc5b4\ub97c \uc81c\uacf5\ud569\ub2c8\ub2e4.<br \/>\n<span style=\"color: #3366ff;\">Objective C\ub294 public, private, \ub610\ub294 protected\ub85c \uc120\uc5b8\ub41c \uc778\uc2a4\ud134\uc2a4\ubcc0\uc218(\ub370\uc774\ud130 \uba64\ubc84)\ub97c \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \u00a0\ud558\uc9c0\ub9cc Method(\uba64\ubc84\ud568\uc218)\ub97c \uad6c\uc131\ud558\ub294 \ub3d9\uc77c\ud55c \ubc29\ubc95\uc744 \uc81c\uacf5\ud558\ub294\uac83\uc740 \uc544\ub2d9\ub2c8\ub2e4.<\/span><\/p>\n<p>+ iostream.h<\/p>\n<p>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.<br \/>\n<span style=\"color: #3366ff;\">C++\uc740 \uc2a4\ud2b8\ub9bc \uae30\ubc18\uc758 i\/o\ub97c \uc704\ud55c ANSI \uc785\ub825\/\ucd9c\ub825\uc744 \uc774\uc6a9\ud55c \uc0c8\ub85c\uc6b4 \uad6c\ud604\ubc29\ubc95\uc744 \uc81c\uacf5\ud569\ub2c8\ub2e4.<\/span><br \/>\n<span style=\"color: #3366ff;\">Objective C\ub294 \u00a0\ube44\uc2b7\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uac00\uc9c0\uace0 \uc788\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4. \ud558\uc9c0\ub9cc Objective C++\uc758 \uba87\uac00\uc9c0 \uad6c\ud604\uc740 \ub2f9\uc2e0\uc758 Objective C++ \ud504\ub85c\uc81d\ud2b8\uc5d0\uc11c c++ io\uc2a4\ud2b8\ub9bc\uc744 \uc0ac\uc6a9\ud560 \uc218 \uc788\uac8c \ud574\uc90d\ub2c8\ub2e4.<\/span><\/p>\n<p>Benefits of Objective C<br \/>\nObjective C\uc758 \uc7a5\uc810<\/p>\n<p>+ Dynamic typing and the id type<br \/>\n+ \ub3d9\uc801 \ud0c0\uc785 \ubc0f id\ud0c0\uc785<\/p>\n<p>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&#8217;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.<br \/>\n<span style=\"color: #3366ff;\">Objective C\uc758 \uac1d\uccb4\uc758 \uc5b4\ub5a4 \ubcc0\uc218\ub4e0\uc9c0 \ud655\uc2e4\ud788 \uc815\uc758\ub418\uc9c0 \uc54a\uc740 \uc720\ud615\uc758 \uac1d\uccb4\ud3ec\uc778\ud130\ub97c \uc758\ubbf8\ud558\ub294 &#8220;id \ud615&#8221;\uc73c\ub85c \uc120\uc5b8\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \u00a0Type(\ud615)\uc740 \uc2e4\ud589\ub420\ub54c\uc5d0 \uacb0\uc815\ub420 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uadf8\ub9ac\uace0 \uc801\ub2f9\ud55c \uba54\uc138\uc9c0\ub97c \ubcf4\ub0b4\ub294\uac70\uc8e0. \u00a0Objective C&#8217;s SEL \ud0c0\uc785\uc744 \uc0ac\uc6a9\ud558\ub824\uba74 \uc2e4\ud589 \uc2dc\uc810\uc5d0\uc11c \uc5b4\ub5a4 \uba54\uc138\uc9c0\ub97c \uac1d\uccb4\uc5d0 \ubcf4\ub0b4\uace0 Method(\uba64\ubc84\ud568\uc218)\uc5d0 \uc5d1\uc138\uc2a4\ud558\uba74 \ub429\ub2c8\ub2e4. \u00a0\uc2e4\ud589\uc2dc \ubb38\uc81c\ub294 \ud504\ub85c\uadf8\ub798\uba38\uac00 \uc2e4\ud589\uc2dc\uc810(respondsToSelector: method\ub97c \ud3ec\ud568\ud558\ub294)\uc5d0\uc11c \uac1d\uccb4\uc5d0\uac8c \uc5b4\ub5a4\uba54\uc138\uc9c0\ub97c \ubcf4\ub0b4\uc11c \uc81c\ub300\ub85c \uc791\ub3d9\ub418\ub294\uc9c0\ub97c \ud14c\uc2a4\ud2b8\ub97c \ud55c\ub2e4\uba74 \ubc29\uc9c0\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/span><br \/>\n<span style=\"color: #3366ff;\">\ud074\ub798\uc2a4\uc758 Methods(\uc815\uc801 \uba64\ubc84\ud568\uc218)\ub77c\uba74 \uac00\ub2a5\ud569\ub2c8\ub2e4. C++ \ud074\ub798\uc2a4\uc640\ub294 \ub2e4\ub974\uac8c Objective C \ud074\ub798\uc2a4\ub294 \uc2e4\ud589\uc2dc\uc5d0(\ub3d9\uc801\ud0c0\uc785\uc774 \uc9c0\uc6d0\ub418\ub294) &#8220;\uc9c4\uc815\ud55c(\uc81c\ub300\ub85c \uad6c\ud604\ub41c)&#8221; \uac1d\uccb4\uc785\ub2c8\ub2e4.<\/span><\/p>\n<p>+ Categories and dynamic loading<br \/>\n+ \uce74\ud14c\uace0\ub9ac\uc640 \ub3d9\uc801\ub85c\ub529<\/p>\n<p>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&#8217;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.<br \/>\n<span style=\"color: #3366ff;\">Objective C\uc758 \ub3d9\uc801\uc778 \ud2b9\uc131\uc740 \uc2e4\ud589\uc2dc\uc758 \ubaa8\ub4e0 \uac1d\uccb4\uc560 \ub300\ud55c \ud655\uc7a5\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. ObjectiveC\ub294 \ub2f9\uc2e0\uc758 \uce74\ud14c\uace0\ub9ac\ub97c \uc815\uc758\ud558\uba70 \uad00\ub828\ub418\uc5b4 \uc0dd\uc131\ub418\uc5b4\uc788\ub358 \uac1d\uccb4\uc758 \ud655\uc7a5\uc744 \uc815\uc758\ud558\uace0 \ud5c8\uc6a9\ud569\ub2c8\ub2e4. \uc608\ub97c \ub4e4\uc790\uba74 \ud14d\uc2a4\ud2b8 \uae30\ubc18\uc758 \uc5b4\ud50c\uc744 \uadf8\ub798\ud53d\uc5b4\ud50c\ub85c \uc804\ud658\ud558\ub824 \ud560\ub54c, \uac1d\uccb4\ub4e4\uc774 \uadf8\ub4e4 \uc790\uc2e0\uc744 \uac00\uc838\uc62c \ud544\uc694\uac00 \uc788\ub294 \ucf54\ub4dc\ub294 \uce74\ud14c\uace0\ub9ac\ucc98\ub7fc \ucef4\ud30c\uc77c \ub420 \uc218 \uc788\uc73c\uba70 \u00a0\ud544\uc694\uc5d0 \ub530\ub77c \uc2e4\ud589\uc2dc\uac04\uc5d0\ub9cc \ub85c\ub4dc \ub429\ub2c8\ub2e4.. \uc774\uac83\uc740 \uba54\ubaa8\ub9ac \uc808\uc57d\uacfc \uc6d0\ub798\uc758 \uac1d\uccb4\uac00 \uc218\uc815\ub418\uc9c0 \uc54a\uc740 \uc0c1\ud0dc\uc5d0\uc11c \ub5a0\ub098\ub294\uac83\uc744 \ud5c8\uc6a9\ud569\ub2c8\ub2e4.<\/span><\/p>\n<p>+ Simple and standard<br \/>\n+ \uac04\ub2e8\ud568 \uadf8\ub9ac\uace0 \ud45c\uc900\uc801<\/p>\n<p>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 &#8216;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.)<br \/>\n<span style=\"color: #3366ff;\">c++\uc740 \uc9c4\ud654\ud558\ub294 \uc5b8\uc5b4\uc774\uba70 \ubcf5\uc7a1\ud569\ub2c8\ub2e4. \ub2e4\ub978 \ucef4\ud30c\uc77c\ub7ec\ub9c8\ub2e4 \ub2e4\ub974\uac8c \uc120\uc5b8\ub418\uc5b4\uc788\ub294\uac83\uc744 \ud559\uc2b5\ud574\uc57c\ud569\ub2c8\ub2e4. \uacb0\uacfc\uc801\uc73c\ub85c C++\uc0ac\uc6a9\uc790\ub294 boolean \ud615\uc2dd\uacfc \uac19\uc740\u00a0\uae30\ub2a5\uc744\u00a0\uc0ac\uc6a9\ud558\ub294 \ubc29\ubc95\uc5d0 \ub300\ud574 \ubaa8\ub4e0 \ucef4\ud30c\uc77c\ub7ec\uc5d0\uc11c \uc9c0\uc6d0\ub418\uc9c0 \uc54a\uc744\uc218\ub3c4 \uc788\uc73c\ub2c8 \uc2e0\uc911\ud574\uc57c \ud569\ub2c8\ub2e4.<\/span><br \/>\n<span style=\"color: #3366ff;\">Objective C\ub294 \ub2e8\uc21c\ud558\uae30 \ub54c\ubb38\uc5d0 \ubb38\uc81c\uac00 \uc788\uc744 \uac00\ub2a5\uc131\uc774 \uc0c1\ub2f9\uc774 \uc801\uc2b5\ub2c8\ub2e4. \uc774\uac83\uc740 \uc548\uc815\uc801\uc778 \uc720\uc9c0\ubcf4\uc218\ub97c \ub3c4\uc640\uc8fc\uac8c\ub429\ub2c8\ub2e4. (\uadf8\ub9ac\uace0 Objective C\ub294 BOOL\ub370\uc774\ud130 \ud0c0\uc785\uc744 \uac00\uc9c0\uace0\uc788\uc8e0)<\/span><\/p>\n<p>+ Shortcuts<\/p>\n<p>C++ doesn&#8217;t have a monopoly on convenient features, either. Objective C&#8217;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.<br \/>\n<span style=\"color: #3366ff;\">C++\uc740 \ud3b8\ub9ac\ud55c \uae30\ub2a5\uc744 \ub3c5\uc810\ud558\uc9c0 \uc54a\uace0 \uc788\uc2b5\ub2c8\ub2e4. \ud558\uc9c0\ub9cc Objective C\ub294 c++\uc2a4\ud0c0\uc77c\uc744 \ud3ec\ud568\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \/\/ \ucf54\uba58\ud2b8\uc640 #include \uc9c0\uc2dc\uc790\uc640 \ube44\uc2b7\ud558\uc9c0\ub9cc \ucc38\uc870\ub41c \ud30c\uc77c\uc744 \ud3ec\ub974\uc81d\ud2b8\ub9c8\ub2e4 \ud55c\ubc88\ub9cc \ud3ec\ud568\ud574\uc11c \ucc98\ub9ac\ud558\ub294 #import \uc9c0\uc2dc\uc790\ub4f1\uc774 \uc788\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<p>An Objective C Primer<br \/>\nObjective C \uae30\ucd08<\/p>\n<p>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&#8217;s promoteToManager member function might look like this:<br \/>\n<span style=\"color: #3366ff;\">C++\ud504\ub85c\uadf8\ub798\uba38\ub294 Objective C\ub85c \uc77c\uc744 \uc2dc\uc791\ud558\ub294 \uacbd\uc6b0 \uad6c\ud604\ud558\ub294 \ubb38\ubc95\uc758 \uc774\uc804\uacfc \ub2e4\ub978 \uc138\uc138\ud55c \ucc28\uc774\uc810\ub4e4\uc744 \ubcf4\uba74 \ube44\uc2b7\ud558\uac8c \ub290\ub084 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uc608\ub97c \ub4e4\uc790\uba74 C++\u00a0Employee\uc758 \uc778\uc2a4\ud134\uc2a4\ub85c\u00a0promoteToManager \uba64\ubc84\ud568\uc218\ub97c \ucc38\uc870\ud558\ub294 \ubc95\uc744 \ubcf4\uaca0\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<p>anEmployee.promoteToManager();<\/p>\n<p>In Objective C, this same call would look like this:<br \/>\n<span style=\"color: #3366ff;\">ObjectiveC\uc758 \uacbd\uc6b0\ub294 \uc704\uc758 \ub3d9\uc791\uc744 \uc774\ub807\uac8c \uad6c\ud604\ud569\ub2c8\ub2e4.<\/span><\/p>\n<p>[anEmployee promoteToManager];<\/p>\n<p>A similar call with two arguments in C++&#8230;<br \/>\n<span style=\"color: #3366ff;\">2\uac1c\uc758 \uc778\uc218\ub97c \ubc1b\ub294 \uacbd\uc6b0\uc5d0 C++\uc740 \uc774\ub807\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<p>anEmployee.promote(newPosition, newSalary);<\/p>\n<p>&#8230;would look like this in Objective C:<br \/>\n<span style=\"color: #3366ff;\">ObjectiveC\ub294 \uc774\ub807\uac8c \uad6c\ud604\ud569\ub2c8\ub2e4.<\/span><\/p>\n<p>[anEmployee promoteToPosition:newPosition atSalary:newSalary];<\/p>\n<p>Here, the member function being called (in Objective C terminology, the instance method being messaged) is called promoteToPosition:atSalary:<br \/>\n<span style=\"color: #3366ff;\">\uc5ec\uae30\ubcf4\uc790. \ud638\ucd9c\ub418\ub294 \uba64\ubc84\ud568\uc218\ub294 (Objective C \uc6a9\uc5b4\ub85c\ub294, \uc778\uc2a4\ud134\uc2a4 \uba54\uc11c\ub4dc\uac00 \uba54\uc138\uc9c0\ub97c \ubc1b\ub294\ub2e4\uace0 \ud55c\ub2e4) promoteToPosition:atSalary: \ub77c\uace0 \ud55c\ub2e4.<\/span><br \/>\nObjective C&#8217;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&#8217;s object model. It is available as part of OpenStep&#8217;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.<\/p>\n<p><span style=\"color: #3366ff;\">Objective C\uc758 \ubb38\ubc95\uacfc \uc774\ub984\uaddc\uce59\uc740\u00a0Object-Oriented Programming and the Objective C Language \ucc45\uc5d0\uc11c \uc790\uc138\ud788 \uc124\uba85\ud558\uaca0\uc2b5\ub2c8\ub2e4.<\/span><br \/>\n<span style=\"color: #3366ff;\">\uc774\ucc45\uc740 OPENSTEP \ud504\ub85c\uc81d\ud2b8\uc5d0\uc11c\u00a0Objective C and C++ \ucf54\ub4dc\ub97c \uacb0\ud569\uc2dc\ud0a4\ub294\uac83\uc5d0 \ub300\ud55c \uc815\ubcf4\uc640\u00a0Objective C\uc758 \uac1d\uccb4 \ubaa8\ub378\uc5d0 \uac10\ucdb0\uc9c4 \uc6d0\uce59\ub4f1\uc5d0 \ub300\ud55c \uc790\uc138\ud55c \uc815\ubcf4\ub97c \ud3ec\ud568\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4.<\/span><br \/>\n<span style=\"color: #3366ff;\">\uc774\uac74 \u00a0OpenStep&#8217;s online documentation\uc758 \uc77c\ubd80\ub85c\uc11c\u00a0Apple Enterprise Software\uc5d0\uc11c \uc778\uc1c4\ubcf8\uc744 \uad6c\ub9e4\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/span><br \/>\n<span style=\"color: #3366ff;\">\uc880 \ub354 \uc790\uc138\ud55c \uc815\ubcf4\ub294 Objective C Usenet FAQ line\uc5d0 \ud3ec\ud568\ub418\uc5b4 \uc788\uc73c\uba70\u00a0http:\/\/world.std.com\/~gsk\/gnu-objc.html(\uc9c0\uae08\uc740 \ubb38\uc11c\uac00 \uc5c6\uc5b4\uc694:\uc5ed\uc790\uc8fc) \ubb38\uc11c\uc758\u00a0GNU Objective-C Project\uc5d0\uc11c \ucc3e\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<p><strong>\uc774 \ubb38\uc11c\ub294 Darkcircle, arvid, neogeo\ub2d8\uc758 \ub3c4\uc6c0\uc73c\ub85c \ubc88\uc5ed\ub418\uc5c8\uc2b5\ub2c8\ub2e4.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Title: C++ vs. Objective C Entry Number: 2589 Creation Date: January 27, 1998 &#8230;.Overview &#8230;.Benefits of C++ &#8230;.Benefits of Objective C &#8230;.An Objective C Primer Overview &#8220;I already know C++. Why do I have to learn Objective C?&#8221; \ub098\ub294 \uc774\ubbf8 C++\uc744 \uc54c\uace0\uc788\uc2b5\ub2c8\ub2e4. \uc65c Objective C\ub97c \ubc30\uc6cc\uc57c \ud558\ub098\uc694? Objective C and C++ are different in their [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"_links":{"self":[{"href":"http:\/\/nextstep.onionmixer.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/83"}],"collection":[{"href":"http:\/\/nextstep.onionmixer.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nextstep.onionmixer.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nextstep.onionmixer.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/nextstep.onionmixer.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=83"}],"version-history":[{"count":14,"href":"http:\/\/nextstep.onionmixer.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/83\/revisions"}],"predecessor-version":[{"id":106,"href":"http:\/\/nextstep.onionmixer.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/83\/revisions\/106"}],"wp:attachment":[{"href":"http:\/\/nextstep.onionmixer.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=83"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nextstep.onionmixer.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=83"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nextstep.onionmixer.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=83"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}