Practice Flashcards
Flip to reveal answersWhat is object-oriented programming?
Track your progress — Sign up free to save your progress and get smart review reminders based on spaced repetition.
All 5 Flashcards — Fundamentals of OOP
Sign up free to track progress and get spaced-repetition review schedules.
Question
What is object-oriented programming?
Answer
An approach that keeps a thing's data and the operations on it in one place. A book's title and its borrow() method live together, rather than the data in one structure and the code elsewhere.
Question
What is the difference between a class and an object?
Answer
A class is the template, saying what every one of this kind will have and can do; it holds no values itself. An object is one actual thing made from that class, with its own values.
Question
What is the difference between inheritance and polymorphism?
Answer
Inheritance is reusing what a more general class already has — Ebook takes Book's title and author. Polymorphism is the same method call answered appropriately by each kind. Inheritance often makes polymorphism possible, but they are different ideas.
Question
Give two advantages and two disadvantages of OOP.
Answer
Advantages: it models real things with data and behaviour, and inheritance gives reuse with no copied code. Disadvantages: the class structure must be designed before coding, and it is more code than a small task needs.
Question
When is OOP not worth using?
Answer
For a short script with no real entities to model — reading a file and printing a total gains nothing from classes while still paying the design and code overhead.
Read the notes
Full study notes for Fundamentals of OOP
Topic 7.1 hub
OOP: a single class
More from Topic 7.1
All flashcards in this topic
Computer Science exam skills
Paper structures & tips
Track your progress with spaced repetition
Sign up free — Aimnova tells you exactly which cards to review and when, so you remember everything before your IB exam.
Start Free