#include <iostream>

class Button {
public:
    virtual void render() = 0;
    virtual ~Button() = default;
};

class Checkbox {
public:
    virtual void check() = 0;
    virtual ~Checkbox() = default;
};

class WinButton : public Button {
public:
    void render() override { std::cout << "Windows Button" << std::endl; }
};

class WinCheckbox : public Checkbox {
public:
    void check() override { std::cout << "Windows Checkbox" << std::endl; }
};

class MacButton : public Button {
public:
    void render() override { std::cout << "macOS Button" << std::endl; }
};

class MacCheckbox : public Checkbox {
public:
    void check() override { std::cout << "macOS Checkbox" << std::endl; }
};

class GUIFactory {
public:
    virtual Button* createButton() = 0;
    virtual Checkbox* createCheckbox() = 0;
    virtual ~GUIFactory() = default;
};

class WinFactory : public GUIFactory {
public:
    Button* createButton() override { return new WinButton(); }
    Checkbox* createCheckbox() override { return new WinCheckbox(); }
};

class MacFactory : public GUIFactory {
public:
    Button* createButton() override { return new MacButton(); }
    Checkbox* createCheckbox() override { return new MacCheckbox(); }
};

int main() {
    GUIFactory* factory = new MacFactory();
    Button* btn = factory->createButton();
    Checkbox* chk = factory->createCheckbox();
    
    btn->render();
    chk->check();
    
    delete btn;
    delete chk;
    delete factory;
    return 0;
}
