#include <iostream>
#include <string>
using namespace std;

class Appliance {
public:
    string name;
    int power;

    Appliance(string n, int p) : name(n), power(p) {}

    void show_info() {
        cout << name << " " << power << endl;
    }
};

class TV : public Appliance {
public:
    TV(string n, int p) : Appliance(n, p) {}

    void change_channel() {
        cout << "채널 변경" << endl;
    }
};

class Refrigerator : public Appliance {
public:
    Refrigerator(string n, int p) : Appliance(n, p) {}

    void change_temperature() {
        cout << "온도 조절" << endl;
    }
};

int main() {
    TV tv("Samsung TV", 200);
    tv.show_info();     
    tv.change_channel();

    Refrigerator rf("LG 냉장고", 300);
    rf.show_info();         
    rf.change_temperature();
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: