删除多个类和结构体的拷贝构造函数和赋值运算符,确保不可复制性
All checks were successful
Build and Upload Artifact / build and upload-artifact (push) Successful in 20m4s

This commit is contained in:
2025-05-21 18:55:14 +08:00
parent 69155f3ce1
commit 2ce600dc4d
10 changed files with 47 additions and 6 deletions

View File

@@ -10,7 +10,11 @@ public:
explicit DfPlayer(UART_HandleTypeDef* uart)
: serialPort(std::make_unique<SerialPort>(uart, kBaudRate, kLength, kTimeout)) {}
~DfPlayer() = default;
~DfPlayer() = default;
DfPlayer(const DfPlayer&) = delete;
DfPlayer& operator=(const DfPlayer&) = delete;
DfPlayer(DfPlayer&&) = delete;
DfPlayer& operator=(DfPlayer&&) = delete;
void Play();
void Stop();