- 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.
- In objective C same name for method and variable is allowed but in C++ it is not.
- Objective C does not respect public and private(it knows about them but doesn't really use them) as it does in C++.
- Objective C does not have constructor and destructor.Instead it has init and free methods,which must be called explicitly.
- C++ uses strong typing and Objective C uses weak typing(run time binding).
- Objective C does not allow stack based objects,C++ these are allowed.
- Operator overloading is not supported in Objective C,C++ these are supported.
- Templates are not allowed in Objective C,C++ these are allowed.
- abstract objects when instantiated,Objective C generates runtime errors,C++ generates compile errors.
10 January, 2010
Objective C Vs C++
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment