Stackflow on the question "C + + and objective-c What are the similarities and differences?" Downstairs of the two provided the information is very good.
One is: Pierre Chatelier wrote <from C + + to objective-c version 2.1 en>
Download Link: http://pierre.chachatelier.fr/programmation/fichiers/cpp-objc-en.pdf
The second is: Michael Rutman writes the C + + Versus objective-c:
Links: http://www.mactech.com/articles/mactech/Vol.13/13.03/CandObjectiveCCompared/
Here's a summary of the differences between OBJECTIVE-C and C + +:
1, the two most common is: all from C evolved from the object-oriented language, both are compatible with the standard C language.
2, the biggest difference between the two is: Objective C is completely dynamic, and C + + is part of the dynamic.
Objective C supports dynamic type resolution (dynamic typing) at run time, dynamically binding and dynamic loading (dynamically loading);
C + + is a compile-time static binding that simulates implementation by embedding classes (multiple inheritance) and virtual functions (virtual tables).
Objective c supports dynamic message forwarding at the language level with the message sending syntax [object function] and C + + as object->function (). The semantics of the two are also different, in Objective C is said to send a message to an object, as to whether the object can respond to the message and whether it is a response or forward message will not be crash, and in C + + is said that the object has an operation, if the object does not have this operation, or compile will error (static binding ), or the program will crash off (dynamic binding).
3, Objective C does not support multiple inheritance, while C + + supports. However, Objective C can achieve this feature more gracefully through proxy (proxy) or category (categories). This also includes the difference between overwriting (overwrite) and overloading (heavy). Objective C does not support function overloading.
4, Function name resolution is also different, Objective C function name resolution is the function name + parameter name, and C + + only includes the function name. Thus the following is legal in Objective C, as the two parse out is similar to FOO:BAR1: and FOO:BAR2: Is different:
-(int) foo: (int) bar BAR1: (int) bar;
-(char*) foo: (int) bar BAR2: (int) bar;
While the following is illegal in C + +, compilation will fail because both parsing is similar to foo:int and the compiler cannot tell:
int foo (int bar, int bar1);
char* foo (int bar, int bar2);
5, Objective-c has no constructors and destructors in C + +, and its counterpart is alloc-init/dealloc;
6, Objective-c 2.0 added the garbage collection mechanism (not available on IPhone and IPad), while C + + did not;
7, Objective-c does not allow the allocation of memory on the Stack, only on the heap, while C + + is allowed;
8, Objective-c does not support templates, C + + support, OBJECTIVE-C does not support namespaces, and C + + support; objective-c also does not support function default parameters, while C + + supports;
Objective-c is a Smalltalk, and C + + is a simula system.
So to speak, Objective-c has a simple wrapper over C, while C + + has a complex wrapper over C + +, but objective-c makes people feel more elegant and concise.
Turn from: Roche ( http://www.cppblog.com/kesalin )