OOP Interview Question

What is Object Oriented Programming?

Updated 2026-08-16 · Beginner friendly
Quick answer

Object Oriented Programming is a way of writing software by grouping data and the behaviour that works on that data into units called objects. Instead of one long list of instructions, you model your program as real world things that talk to each other. This makes large codebases easier to organise, reuse, and maintain.

Key takeaways
  • OOP groups data and the behaviour that works on it into units called objects.
  • A class is a blueprint, and an object is a real instance created from that blueprint.
  • It improves organisation, reuse, and maintenance by modelling code as real world things.

The simple idea

Imagine you are building an app for a bank. You have customers, accounts, and transactions. In Object Oriented Programming you create a blueprint for each of these things. That blueprint is called a class. When you actually create one customer or one account in memory, that is called an object.

Each object carries two things together. It carries data, which we call fields or attributes, and it carries actions, which we call methods. An Account object might store a balance and offer methods like deposit and withdraw. Everything about an account lives in one place, so the code stays tidy and easy to reason about.

A tiny example

class Account {
    double balance = 0;   // data
public:
    void deposit(double amount) {   // behaviour
        balance = balance + amount;
    }
    double getBalance() {
        return balance;
    }
};

// Using the class
Account myAccount;          // myAccount is an object
myAccount.deposit(500);
cout << myAccount.getBalance();  // 500
class Account {
    private double balance;   // data

    void deposit(double amount) {   // behaviour
        balance = balance + amount;
    }

    double getBalance() {
        return balance;
    }
}

// Using the class
Account myAccount = new Account();  // myAccount is an object
myAccount.deposit(500);
System.out.println(myAccount.getBalance());  // 500.0
class Account:
    def __init__(self):
        self._balance = 0        # data

    def deposit(self, amount):   # behaviour
        self._balance += amount

    def get_balance(self):
        return self._balance

# Using the class
my_account = Account()           # my_account is an object
my_account.deposit(500)
print(my_account.get_balance())  # 500

Here Account is the class, or blueprint. The variable myAccount is a real object built from that blueprint. The balance is hidden inside and can only be changed through the deposit method, which keeps the data safe.

Why teams use it

In the interview

In an interview, define it in one clean sentence first, then give a real world example like a Car or an Account. Interviewers love that you can connect the concept to something concrete instead of only reciting a textbook line.

Frequently asked questions

What are the advantages of OOP over procedural programming?

OOP keeps related data and behaviour together, supports reuse through classes and inheritance, and scales better for large codebases than procedural code.

What are the four pillars of OOP?

Encapsulation, abstraction, inheritance, and polymorphism. A common memory aid is A PIE for Abstraction, Polymorphism, Inheritance, and Encapsulation.

Want the full OOP guide?

Read every OOP concept with notes, diagrams, and code in one place. Track your progress as you go.

Open the OOP guide All OOP questions