What are classes, objects, and methods in Objective-C?

Updated Feb 20, 2026

Short answer

Classes are blueprints that define the structure and behavior of objects in Objective-C. An object is an instance of a class, and a method is a function that belongs to a class and defines what an object (or the class itself) can do. Together, these three concepts form the foundation of object-oriented programming in Objective-C.

Deep explanation

Objective-C is an object-oriented programming (OOP) language. Instead of writing programs as a collection of unrelated functions, Objective-C organizes code into classes, objects, and methods.

==Remember this interview shortcut: Class = Blueprint, Object = Instance, Method = Behavior.==

What is a Class?

A class is a blueprint or template used to create objects. It describes:

  • The properties (data) an object stores.
  • The methods (actions) an object can perform.
  • The common characteristics shared by all objects of that type.

Think of a class as an architectural drawing for a house. The blueprint itself is not a real house—it only describes how every house should be built.

For example, a Car class may contain:

  • color
  • speed
  • brand

and methods such as:

  • startEngine
  • drive
  • stop

What is an Object?

An object is a real instance created from a class.

Every object:

  • Has its own copy of the class's properties.
  • Shares the same method implementations defined by the class.
  • Can behave differently because its property values may differ.

For example:

ClassObjects
CarRed Car, Blue Car, Black Car

Although all three cars come from the same class, each object has its own color and speed.

Every object has its own state, but all objects of the same class share the same behavior.

What is a Method?

A method is a function that belongs to a class.

Methods define what an object can do.

Objective-C has two kinds of methods.

TypeSymbolCalled OnExample
Instance Method-Object- (void)drive;
Class Method+Class+ (Car *)newCar;

Instance methods

These operate on a particular object.

OBJECTIVE-C
[myCar drive];

Class methods

These are called directly on the class.

OBJECTIVE-C
Car *myCar = [Car new];

They are commonly used to create objects or perform utility operations.

How Classes, Objects, and Methods Work Together

The typical flow is:

  1. Define a class.
  2. Create an object from that class.
  3. Call methods on the object.
  4. The object's state changes.
Rendering diagram…

Example

Car.h
@interface Car : NSObject
@property(nonatomic, strong) NSString *color;
- (void)drive;
@end
Car.m
@implementation Car
- (void)drive {
NSLog(@"%@ car is driving.", self.color);
}
@end
main.m
Car *myCar = [[Car alloc] init];
myCar.color = @"Red";
[myCar drive];

Output:

TEXT
Red car is driving.

Here:

  • Car is the class.
  • myCar is the object.
  • drive is an instance method.
  • color is a property.
💡 A simple interview rule: A class describes what something is, an object represents a real thing, and methods describe what that thing can do.

Message Passing in Objective-C

Unlike many languages that call methods directly, Objective-C uses message passing.

OBJECTIVE-C
[myCar drive];

This means:

  1. Send the message drive.
  2. The Objective-C runtime looks for the corresponding method.
  3. The method is executed.

Objective-C objects communicate by sending messages rather than calling functions directly.

Real-world example

Imagine you're developing a food delivery application.

You define a DeliveryDriver class.

Every driver who signs up becomes an object.

Each driver has different information:

  • Name
  • Vehicle
  • Rating

However, every driver can perform the same actions:

  • Accept an order
  • Deliver food
  • Complete delivery
OBJECTIVE-C
DeliveryDriver *driver = [[DeliveryDriver alloc] init];
driver.name = @"Alice";
[driver acceptOrder];
Rendering diagram…

One class can create many independent objects, each with its own data while sharing the same methods.

Common mistakes

  • * **Confusing classes and objects** — A class is only a blueprint
  • it does not store individual data until an object is created.
  • * **Calling an instance method on a class** — Instance methods require an object. Use class methods only on the class itself.
  • * **Assuming all objects share property values** — Objects share method definitions, but every object stores its own property values.
  • * **Ignoring message passing** — Objective-C sends messages (`[object method]`) instead of using traditional function-call syntax.
  • * **Thinking properties are methods** — Properties store data, while methods define behavior.

Follow-up questions

  • What is the difference between a class and an object?
  • What is the difference between instance methods and class methods?
  • Why does Objective-C use message passing?
  • What is the role of NSObject?

More Objective-C interview questions

View all →