Compare commits

...

1 Commits

Author SHA1 Message Date
MarioYang 97e059df5d mothed 1 2025-04-24 14:05:05 +08:00
1 changed files with 10 additions and 0 deletions

10
1st.cpp
View File

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