#include <iostream>
#include <cstdint>
using namespace std;
class UARTHardware {
private:
int baud;
public:
// Implement constructor to store baud rate
// Delete copy constructor
// Delete copy assignment operator
UARTHardware(int b) {
baud = b;
}
UARTHardware(const UARTHardware&) = delete;
UARTHardware& operator= (const UARTHardware&) = delete;
void sendByte(uint8_t value) const {
cout << "TX: " << (int)value;
}
};
int main() {
int baudRate;
cin >> baudRate;
int temp;
cin >> temp;
uint8_t byteToSend = (uint8_t)temp;
UARTHardware uart(baudRate);
// Demonstration (must not compile if uncommented)
// UARTHardware copy = uart;
uart.sendByte(byteToSend);
return 0;
}
Input
9600 65
Expected Output
TX: 65