Skip to Main Content
Hands-On Embedded Programming with C++17
book

Hands-On Embedded Programming with C++17

by Maya Posch
January 2019
Intermediate to advanced content levelIntermediate to advanced
458 pages
10h 35m
English
Packt Publishing
Content preview from Hands-On Embedded Programming with C++17

Classes

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& ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Embedded Programming with Modern C++ Cookbook

Embedded Programming with Modern C++ Cookbook

Igor Viarheichyk

Publisher Resources

ISBN: 9781788629300Supplemental Content