Home > DeveloperSection > Interviews > Objective C Vs C++

Posted on    September-10-2015 11:48 PM

 iPhone iPhone  Ios  Objective C 
 1 Answer(s)
  389  View(s)
Rate this:

Tarun Kumar

Total Post:107

Posted on    September-10-2015 11:48 PM

-        The Objective C class allows a method and a variable with the exact same name. In C++, they must be different.

-        Objective C does not have a constructor or destructor, instead it has init and dealloc methods, which must be called explicitly.

-        Objective C uses + and – to differentiate between factory and instance methods, C++ uses static to specify a factory method.

-        Multiple inheritance is not allowed in Obj C, however we can use protocol to some extent.

-        Obj C has runtime binding leading to dynamic linking.

-        Obj C has got categories.

-        Objective C has a work-around for method overloading, but none for operator overloading.

-        Objective C also does not allow stack based objects. Each object must be a pointer to a block of memory.

-        In Objective C the message overloading is faked by naming the parameters. C++ actually does the same thing but the compiler does the name mangling for us. In Objective C, we have to mangle the names manually.

-        One of C++’s advantages and disadvantages is automatic type coercion.

-        Another feature C++ has that is missing in Objective C is references. Because pointers can be used wherever a reference is used, there isn’t much need for references in general.

-        Templates are another feature that C++ has that Objective C doesn’t. Templates are needed because C++ has strong typing and static binding that prevent generic classes, such as List and Array.

Modified On Sep-10-2015 11:49:15 PM

Don't want to miss updates? Please click the below button!

Follow MindStick