#include <iostream>
using namespace std;
// Bootloader UART driver
namespace Boot {
namespace UART {
void send() {
cout << "BOOT UART";
}
}
}
// Application UART driver
namespace App {
namespace UART {
void send() {
cout << "APP UART";
}
}
}
int main() {
int mode;
cin >> mode;
if (mode == 1) {
Boot::UART::send();
}
else if (mode == 2) {
App::UART::send();
}
return 0;
}
Explanation & Logic Summary:
send()Boot::UART and App::UART) prevent naming conflictsFirmware Relevance & Real-World Context:
Input
1
Expected Output
BOOT UART