#include <iostream> using namespace std; class Chain { public: bool Handle() { return false; } }; class Level1 : public Chain { public: bool Handle() { cout<<"Level1::true"<<endl; return true; } }; class Level2 : public Level1 { public: bool Handle() { cout<<"Level2::Handle"<<endl; return Level1::Handle(); } }; class Level3 : public Level2 { public: bool Handle() { cout<<"Level3::Handle"<<endl; return Level2::Handle(); } }; int main(int argc, char *argv[]) { Level3 level3; level3.Handle(); return 0; }
时间: 2024-10-15 17:51:48