Create a class named Frame that represents a UART transmit frame with a maximum capacity of 16 bytes.
The class must internally store bytes using a fixed-size array and must not use dynamic memory allocation.
You are required to overload operators to make frame construction intuitive and safe for firmware-style usage.
Requirements
You must implement the following in the Frame class:
operator+= to append a single byte to the frameoperator[] to access a byte by index for read-only purposesThe frame must never exceed 16 bytes. The input provided will always respect this limit.
Program Behavior
Your program must:
n — the number of bytes to appendn integers, each representing a byte value in the range 0–255operator+=
Input Format
n
b1 b2 b3 ... bn
n is an integer where 1 ≤ n ≤ 16b is an integer where 0 ≤ b ≤ 255Output Format
b1 b2 b3 ... bn
Each value must be printed as a decimal integer, separated by a single space.
Example 1
Input:
4
10 20 30 40
Output:
10 20 30 40
Example 2
Input:
3
255 0 128
Output:
255 0 128
Constraints
uint8_tnew, malloc, STL containers, etc.)operator+= and operator[] may be used for frame access
Input
4 10 20 30 40
Expected Output
10 20 30 40