Photo AI
Last Updated Sep 27, 2025
Revision notes with simplified explanations to understand Object Oriented Techniques quickly and effectively.
350+ students studying
Object-Oriented Programming (OOP) is a programming paradigm that organises software design around objects, which represent real-world entities. OOP provides a modular approach to software development, making it easier to build, maintain, and scale complex systems. Understanding OOP concepts like classes, objects, methods, encapsulation, inheritance, and polymorphism is crucial for writing efficient and reusable code.
Example in Python:
class Car:
def __init__(self, brand, model):
self.brand = brand # Attribute
self.model = model # Attribute
def display_info(self): # Method
print(f"{self.brand} {self.model}")
An instance of a class.
Example:
my_car = Car("Toyota", "Corolla")
my_car.display_info() # Outputs: Toyota Corolla
Attributes store the data or state of an object.
_
or __
(e.g., _balance
). They cannot be accessed directly outside the class.class Account:
def __init__(self, balance):
self.__balance = balance # Private attribute
Methods are functions defined within a class that describe the behaviours of an object.
@staticmethod
.@classmethod
.Encapsulation is the principle of restricting direct access to an object's attributes and methods to protect its integrity.
Used to access and modify private attributes.
class Account:
def __init__(self, balance):
self.__balance = balance
def get_balance(self): # Getter
return self.__balance
def set_balance(self, amount): # Setter
if amount >= 0:
self.__balance = amount
class Animal:
def speak(self):
print("Animal sound")
class Dog(Animal): # Dog is a subclass of Animal
def speak(self):
print("Bark")
super()
Function:Allows access to the superclass's methods and attributes.
class Dog(Animal):
def __init__(self, name):
super().__init__()
self.name = name
class Animal:
def speak(self):
print("Animal sound")
class Dog(Animal):
def speak(self):
print("Bark")
class Cat(Animal):
def speak(self):
print("Meow")
animals = [Dog(), Cat()]
for animal in animals:
animal.speak()
Outputs:
Bark
Meow
Class diagrams visually represent the structure of a class, including its attributes, methods, and relationships with other classes.
Example:
+---------------------+
| Car |
+---------------------+
| - brand: String |
| - model: String |
+---------------------+
| + display_info() |
+---------------------+
Design a system for managing books in a library.
Classes:
Book
: Represents individual books.Member
: Represents library members.Library
: Manages the collection of books and members.
Code Implementation:class Book:
def __init__(self, title, author):
self.title = title
self.author = author
def display(self):
print(f"{self.title} by {self.author}")
class Library:
def __init__(self):
self.books = []
def add_book(self, book):
self.books.append(book)
def show_books(self):
for book in self.books:
book.display()
# Using the system
lib = Library()
book1 = Book("1984", "George Orwell")
book2 = Book("Brave New World", "Aldous Huxley")
lib.add_book(book1)
lib.add_book(book2)
lib.show_books()
Enhance your understanding with flashcards, quizzes, and exams—designed to help you grasp key concepts, reinforce learning, and master any topic with confidence!
80 flashcards
Flashcards on Object Oriented Techniques
Revise key concepts with interactive flashcards.
Try Computer Science Flashcards8 quizzes
Quizzes on Object Oriented Techniques
Test your knowledge with fun and engaging quizzes.
Try Computer Science Quizzes29 questions
Exam questions on Object Oriented Techniques
Boost your confidence with real exam questions.
Try Computer Science Questions27 exams created
Exam Builder on Object Oriented Techniques
Create custom exams across topics for better practice!
Try Computer Science exam builder12 papers
Past Papers on Object Oriented Techniques
Practice past papers to reinforce exam experience.
Try Computer Science Past PapersDiscover More Revision Notes Related to Object Oriented Techniques to Deepen Your Understanding and Improve Your Mastery
Join 500,000+ A-Level students using SimpleStudy...
Join Thousands of A-Level Students Using SimpleStudy to Learn Smarter, Stay Organized, and Boost Their Grades with Confidence!
Report Improved Results
Recommend to friends
Students Supported
Questions answered