Day 3: Object Oriented Programming with C++
Resources
Zoom meeting link for today's session is available in the Bookmarks on the course Slack channel.
To create the starter repository for today's session please click hereLink opens in a new window
Programme
C++: Data structures |
We introduce object orientation through basic structures to create custom types, and see how these simplify and increase the cohesion of our code. The exercises cover creating a structure to represent the data passed to the program through command line arguments. |
C++: Classes |
In the second part of the day, we introduce classes in C++. We see the basic syntax required to declare and define classes, contrasting this with our earlier look at structures. The basic class infrastructure of constructors, operators and member functions is discussed. The exercises involve creating a class for the Caesar Cipher implemented on Day 2. |
Unit Testing with Catch |
We introduce unit testing to check that our functions produce the correct output for a given input. The monolithic mpags-cipher executable is first split into a main program and implementation library using CMake to enable the implementation to be tested. The walkthrough continues with using CMake together with the Catch Unit Testing Framework to write and run tests for mpags-cipher. |