Syllabus for Object-Oriented Programming (5CCYB041)
This is a list of topics to be covered on this module. Note that during the course, topics will not necessarily be introduced in the order presented on this page.
The Unix command-line
- what is the command-line, the terminal, and the shell
- the filesystem, absolute & relative paths
- basic commands:
ls
, pwd
, cd
, cp
, mv
, rm
, …
- command structure, arguments & options
- using an editor (whether terminal-based or external)
Compiling a C++ program
- difference between compiled and interpreted languages
- invoking the compiler
- useful compiler flags:
-o
, -O2
, -Wall
, -c
, -I
, -g
- different stages of compilation: preprocessor, compiler, linker
- compiling and linking programs split over multiple files
- understand concept of build systems to simplify building complex programs (
Make
, CMake
, …)
- using the
oop_build
script supplied as part of this course
Basic structure of a program
- the
main()
function
- preprocessor directives, particularly
#include
- difference between using inverted commas
""
and angled brackets <>
in #include
directive
- handling command-line arguments
- return value / exit code
Data types & variables
- basic data types:
int
, short
, char
, and their unsigned
versions, float
, double
, …
- declaring a variable
- defining a variable
- the
auto
keyword
- Compound data types: structs & classes
- Dynamic vs. static type handling
- Basic operators:
=
, +
, -
, *
, /
, %
, ++
, --
, <<
, >>
, +=
, -=
, *=
, /=
- implicit type conversions
Control flow
- the
if
/else
statement
- statements & compound statements
- the standard
for
loop
- the range-based
for
loop
- the
while
loop
- the
do
/while
loop
- conditional operators:
==
, !=
, <
, >
, <=
, >=
- compound conditional expressions using logical operators:
&&
, ||
, !
- the conditional (ternary)
?:
operator
Functions
- purpose of functions (control flow, code re-use, code clarity, …)
- function declaration vs. definition
- general syntax
- function arguments, default arguments
- return statement, return type
- returning multiple values from functions using C++17 structured binding
- function overloading
inline
keyword
- lambda functions
- lambda capture
- use of lambda functions in STL algorithms
Error handling using exceptions
Namespaces
- what they are, and their purpose
using
declaration
- why indiscriminate use of
using namespace std;
is discouraged
- declaring your own namespace (not assessed)
Classes
- simple
struct
, difference between struct
& class
- declaration & definition
- general syntax
public
, protected
, private
- methods / member functions
- special methods: constructor, copy-constructor, destructor
- implicit inline methods
- syntax for defining methods outside class, and where to place method definitions
Inheritance
- purpose and syntax
public
, protected
and private
inheritance
- function hiding
- virtual functions
- pure virtual functions and abstract classes
OOP design
- OOP principles: encapsulation, abstraction, inheritance, polymorphism
- UML, focussing on UML class diagrams
- aggregation, composition, inheritance
- SOLID principles and others
- prefer composition over inheritance
- object lifetime and ownership
- Resource acquisition is initialisation (RAII)
Templates
- what they are, and why they’re useful
- general syntax
- template type and non-type parameters
typename
& class
keywords
- static / compile-time polymorphism
- template functions
- template classes
- template class methods
- why template functions & methods must all be defined in headers, not cpp files
The Standard Template Library
- useful containers:
std::vector
, std::array
, std::string
- algorithms & iterators
- the
std::ranges
library
- useful algorithms:
std::ranges::sort()
, std::ranges::max()
, std::ranges::min()
, std::ranges::find()
, …
- pointers
- C-style arrays
- memory allocation & deallocation using
new
& delete
- array allocation & deallocation using
new[]
& delete[]
- allocating on the heap vs. allocating on the stack
- why use of raw pointers and manual memory management is to be avoided unless absolutely necessary