zoukankan      html  css  js  c++  java
  • 代理模式(C++)

    #include <iostream>
    using namespace std;
    
    class surfinternet
    {
    public:
        surfinternet(){}
        virtual ~surfinternet(){}
        virtual void look_youtube()=0;
        virtual void look_twitter()=0;
        virtual void look_fackbook()=0;
    };
    
    class overwall : public surfinternet
    {
    public:
        overwall(){}
        virtual ~overwall(){}
        void look_youtube(){cout<<"look youtube"<<endl;}
        void look_twitter(){cout<<"look twitter"<<endl;}
        void look_fackbook(){cout<<"look facebook"<<endl;}
    };
    
    class proxy : public surfinternet
    {
    public:
        proxy(){psurfnet=new overwall;}
        virtual ~proxy(){delete psurfnet;}
        void look_youtube(){psurfnet->look_youtube();}
        void look_twitter(){psurfnet->look_twitter();}
        void look_fackbook(){psurfnet->look_fackbook();}
    
    private:
        surfinternet *psurfnet;
    };
    
    int main()
    {
        surfinternet *p=new proxy;
        p->look_youtube();
        p->look_twitter();
        p->look_fackbook();
        delete p;
    
        system("pause");
        return 0;
    }
  • 相关阅读:
    android flash air 打包工具
    MyEclipse 7.0快捷键大全
    android mp4 videoView
    位图处理
    myeclise10.0下载
    dropdown.js
    back track
    ANE 跨平台 as3 转 objectc android desktop
    jquery 例子
    android 屏蔽 home 2
  • 原文地址:https://www.cnblogs.com/tiandsp/p/2564351.html
Copyright © 2011-2022 走看看