Module Introduction
Recommended Schedule
- Mon-Tue (1-2h)
- Watch videos, take a quiz, ask discussion questions.
- Tue-Wed (3h)
- Attend a lab and solve programming exercises.
- Wed (1h)
- Lecture, Q&A at 1pm.
Contact
Enquiries should be directed to Patrick Totzke at: totzke@liverpool.ac.uk.
The professor will also be on Gather on Wednesdays 2-3pm.
Introduction to OOP
OOP is based on the idea of interacting object which contain both data and procedures and are an instances of a whole “class” of similar objects.
- Encapsulation
- Grouping data and code that acts on it into a single unit.
- Abstraction
- Hiding implementation details from users.
- Inheritance
- Using known classes of objects as blueprints from more specific ones.
- Polymorphics
- Different behaviours of subclasses by reconfiguring methods.
Class Introduction
Suppose that we make a class of person
. They have data associated with them and methods they can perform.
You can have many instances of this object with different data.
Subclasses
Extending this, a student
is a person
with additional data (such as studentID
)
You can make a subclass that extends the original class. This means that you inherit the information from the parent class.
Polymorphism
This is the concept that different objects in different subclasses, but in the same superclass, can be addressed in the same way but retrieve different results.
An example of this is a student
who is foreign
may respond to a greeting in a different language.