10 January, 2010

Objective C Vs C++


  1. Declaration changes:Class declaration-in C++ each class is structure and variables, methods are in that structure.In Objective C variables are in one section and methods are in another section.Objective C uses + & - to differentiate between factory and instance methods,C++ uses static to specify a factory method.Method declaration varies,Objective C uses small talk approach.Method calls syntax varies,C++ uses arrow operator and objective C uses square operator.
  2. In objective C same name for method and variable is allowed but in C++ it is not.
  3. Objective C does not respect public and private(it knows about them but doesn't really use them) as it does in C++.
  4. Objective C does not have constructor and destructor.Instead it has init and free methods,which must be called explicitly.
  5. C++ uses strong typing and Objective C uses weak typing(run time binding).
  6. Objective C does not allow stack based objects,C++ these are allowed.
  7. Operator overloading is not supported in Objective C,C++ these are supported.
  8. Templates are not allowed in Objective C,C++ these are allowed.
  9. abstract objects when instantiated,Objective C generates runtime errors,C++ generates compile errors. 

No comments:

Post a Comment