//
// Created by win10 on 2021/11/16.
//
#include <thread>
#include <iostream>
using namespace std;
class Person {
public:
    Person() {};
    virtual ~Person() {};
    Person(string name) {
        this->m_name = name;
    }
    virtual void show() {
        std::cout << "this->m_name: " << this->m_name << std::endl;
    }
private:
    string m_name;
};
// 装饰类
class Finery: public Person {
public:
    void decorate(Person* person) {
        this->m_person = person;
    }
    virtual void show() {
        this->m_person->show();
    }
protected:
    Person* m_person;
};
class TShirts: public Finery {
public:
    virtual void show() {
        std::cout << "TShirts" << std::endl;
        this->m_person->show();
    }
};
class BigTrouser: public Finery {
public:
    virtual void show() {
        std::cout << "BigTrouser" << std::endl;
        this->m_person->show();
    }
};
int main() {
    Person* person = new Person("tqz");
    TShirts* tShirts = new TShirts();
    BigTrouser* bigTrouser = new BigTrouser();
    bigTrouser->decorate(person);
    tShirts->decorate(bigTrouser);
    tShirts->show();
    return 0;
}