---
title: "How do I make a static and a class method in Objective C?"  
description: "How do I make a static and a class method in Objective C?"  
author: "Tarun Kumar"  
published: 2015-07-16  
updated: 2020-09-21  
canonical: https://www.mindstick.com/interview/2706/how-do-i-make-a-static-and-a-class-method-in-objective-c  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 2 minutes  

---

# How do I make a static and a class method in Objective C?

A **class method** is a method whose execution is scoped to the method’s class. It does not require an instance of an object to be the receiver of a message.

An instance method is a method whose execution is scoped to a particular instance of the class. In other words, before you call an instance method, you must first create an instance of the class. Instance methods are the most common type of method.

## Complete Example:

```
#import< Foundation/Foundation.h> @interface SampleClass:NSObject    + (void)classMethod;    - (void)instanceMethod;@end @implementation SampleClass    +(void)classMethod{        NSLog(@"This is a class method.");    }    -(void)instanceMethod{        NSLog(@"This is a instance method.");    }    @end int main(){    [SampleClass classMethod];               // calling class method     SampleClass *object = [[SampleClass alloc]init];    [object instanceMethod];                  // calling instance method     return 0;}
```

## Answers

### Answer by Tarun Kumar

A **class method** is a method whose execution is scoped to the method’s class. It does not require an instance of an object to be the receiver of a message.

An instance method is a method whose execution is scoped to a particular instance of the class. In other words, before you call an instance method, you must first create an instance of the class. Instance methods are the most common type of method.

## Complete Example:

```
#import< Foundation/Foundation.h> @interface SampleClass:NSObject    + (void)classMethod;    - (void)instanceMethod;@end @implementation SampleClass    +(void)classMethod{        NSLog(@"This is a class method.");    }    -(void)instanceMethod{        NSLog(@"This is a instance method.");    }    @end int main(){    [SampleClass classMethod];               // calling class method     SampleClass *object = [[SampleClass alloc]init];    [object instanceMethod];                  // calling instance method     return 0;}
```


---

Original Source: https://www.mindstick.com/interview/2706/how-do-i-make-a-static-and-a-class-method-in-objective-c

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
