Skip to main content Skip to navigation

Day 5: Object Oriented Programming with C++

Create new repository for today

The Vigenère cipher and object composition in C++

We start by implementing the last of our ciphers: the Vigenère cipher. This requires the use of object composition, a powerful way of resuing code. (PDF Document)

Dynamic Polymorphism in C++

We consider the concepts of polymorphism and shared type in C++ by reviewing the builtin types and templated types as seen in the previous weeks. We motivate sharing type by considering how objects may change through the lifetime of a program and how templates, whilst allowing polymorphic behaviour, lock the behaviour in when our program is compiled. In C++ we show how runtime polymorphism is realised with public inheritance and pure abstract classes specifying an interface. (PDF Document)

Smart Pointers in C++

We see how to use smart pointers to manage the lifetime of objects beyond the scope in which they are created. (PDF Document)