...
Code Block | ||||
---|---|---|---|---|
| ||||
class EncodedPacket { public: EncodedPacket(uint8_t *data, uint8_t len); const uint8_t *getData() const; uint8_t getLen() const; DecodedPacket *decode(); private: const uint8_t * const data; const uint8_t len; Static const void print(){ std::cout << "This is a function!"; } }; |
Constants
Everything should be a constant reference if possible. By default, functions will make a copy of what is passed in, which we do not want.
Code Block | ||||
---|---|---|---|---|
| ||||
uint8_t const &dataRef = data;
//NOT
uint8_t dataRef = data; |