---
title: "Objective C Vs C++"  
description: "Objective C Vs C++"  
author: "Tarun Kumar"  
published: 2015-09-10  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/22819/objective-c-vs-c-plus-plus  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 3 minutes  

---

# Objective C Vs C++

- 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.

## Answers

### Answer by Tarun Kumar

- 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.


---

Original Source: https://www.mindstick.com/interview/22819/objective-c-vs-c-plus-plus

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
