---
title: "Define Class Introspection"  
description: "Define Class Introspection"  
author: "Tarun Kumar"  
published: 2015-09-19  
updated: 2020-09-20  
canonical: https://www.mindstick.com/interview/22832/define-class-introspection  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# Define Class Introspection

- Determine whether an objective-C object is an instance of a class:

[obj isMemberOfClass:ColorClass];

- Determine whether an objective-C object is an instance of a class or its descendants:

[obj isKindOfClass:ColorClass];

- The version of a class:

[ColorString version]

- Find the class of an Objective-C object:

Class myClass1 = [obj1 class];

Class myClass1 = [NSString class];

- Verify 2 Objective-C objects are of the same class:

[obj1 myClass2] == [obj2 class]

## Answers

### Answer by Tarun Kumar

- Determine whether an objective-C object is an instance of a class:

[obj isMemberOfClass:ColorClass];

- Determine whether an objective-C object is an instance of a class or its descendants:

[obj isKindOfClass:ColorClass];

- The version of a class:

[ColorString version]

- Find the class of an Objective-C object:

Class myClass1 = [obj1 class];

Class myClass1 = [NSString class];

- Verify 2 Objective-C objects are of the same class:

[obj1 myClass2] == [obj2 class]


---

Original Source: https://www.mindstick.com/interview/22832/define-class-introspection

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
