⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fishforth.cpp

📁 C++&datastructure书籍源码,以前外教提供现在与大家共享
💻 CPP
字号:
 // from backandforth.cpp
 class BackForthBouncer : public Bouncer
 {
   public:
     BackForthBouncer(Shape * left, Shape * right,
                      double angle, double velocity);
     virtual void updateright (AnimatedCanvas& c, Point& p);
     virtual void updateleft  (AnimatedCanvas& c, Point& p);  
     virtual Shape* clone();
   protected:
     Shape * myLeft;
     Shape * myRight;
 };

 void BackForthBouncer::updateright(AnimatedCanvas& c, Point& p)
 {
    myShape = myLeft;          // use left-facing shape
    myShape->setLocation(p);   // update location
    Bouncer::updateright(c,p); // bounce
 }

 void BackForthBouncer::updateleft(AnimatedCanvas& c, Point& p)
 {
   myShape = myRight;          // use right-facing shape
   myShape->setLocation(p);    // update location
   Bouncer::updateleft(c,p);   // bounce
 }

 Shape* BackForthBouncer::clone()
 {
   return 
      new BackForthBouncer(myLeft,myRight,myAngle,myVelocity);
 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -