#include <iostream>
using namespace std;
class TV {
protected:
int channel;
int volume;
public:
TV() {
channel = 1;
volume = 10;
}
void showInfo() {
cout << "현재 채널: " << channel << endl;
cout << "현재 볼륨: " << volume << endl;
}
};
class Remote : public TV {
public:
void changeChannel(int ch) {
channel = ch;
cout << "채널이 " << channel << "번으로 변경되었습니다." << endl;
}
void volumeControl(int v) {
volume += v;
if (volume < 0) volume = 0;
if (volume > 100) volume = 100;
cout << "볼륨이 " << volume << "으로 조절되었습니다." << endl;
}
};
int main() {
Remote r;
cout << "[Before]" << endl;
r.showInfo();
int ch, vol;
cout << "\n[After]" << endl;
r.showInfo();
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: