This commit is contained in:
MarioYang 2025-04-24 14:05:05 +08:00
parent b9fcfb164d
commit 97e059df5d
1 changed files with 10 additions and 0 deletions

10
1st.cpp
View File

@ -18,9 +18,19 @@ public:
class Motor : public Device { class Motor : public Device {
public: public:
void turnOn() override { void turnOn() override {
if(needsWarmup()) {
warmup(); // 預熱馬達
}
// 啟動馬達 // 啟動馬達
} }
void turnOff() override { void turnOff() override {
// 關閉馬達 // 關閉馬達
} }
private:
bool needsWarmup() {
// 判斷馬達是否需要預熱
}
void warmup() {
// 預熱馬達
}
}; };