Skip to main content Skip to navigation

Day 3: Object Oriented Programming with C++

Create new repository for today

https://classroom.github.com/a/VhdPnSoE

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. (PDF Document)

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. (PDF Document)

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. (PDF Document)