Day 5: 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++: Structured binding declarations |
We start with a brief introduction to structured binding declarations, which were introduced in C++17. We see how they can make code more easy to understand. |
C++: Namespaces |
We continue with a brief discussion of namespaces. We see how they can help to group related functions and objects. |
C++: The Vigenère cipher & object composition |
We continue by implementing the last of our ciphers: the Vigenère cipher. This requires the use of object composition, a powerful way of resuing code. |
C++: Dynamic Polymorphism |
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. |
C++: Smart Pointers |
We see how to use smart pointers to manage the lifetime of objects beyond the scope in which they are created. |