January 2019
Intermediate to advanced
458 pages
10h 35m
English
Object-oriented programming (OOP) has been around since the days of Simula, which was known for being a slow language. This led Bjarne Stroustrup to base his OOP implementation on the fast and efficient C programming language.
C++ uses C-style language constructs to implement objects. This becomes obvious when we take a look at C++ code and its corresponding C code.
When looking at a C++ class, we see its typical structure:
namespace had { using uint8_t = unsigned char; const uint8_t bufferSize = 16; class RingBuffer { uint8_t data[bufferSize]; uint8_t newest_index; uint8_t oldest_index; public: enum BufferStatus { OK, EMPTY, FULL }; RingBuffer(); BufferStatus bufferWrite(const uint8_t byte); enum BufferStatus bufferRead(uint8_t& ...