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

📄 fun_over.cpp

📁 不错书对C++/C程序员很有用的大家不要错过.
💻 CPP
字号:
#include <iostream.h>

class loc {
  int longitude, latitude;
  public:
    loc(void) {}                //  Used to construct temporaries
    loc (int lg, int lt)
      {
      longitude = lg;
      latitude = lt;
      }

    void show(void)
      {
      cout << longitude << " ";
      cout << latitude << endl;
      }

    loc operator+(loc op2);
    loc operator()(int i, int j);
  };

loc loc::operator()(int i, int j)
 {
  longitude = i;
  latitude = j;
  return *this;
 }

loc loc::operator+(loc op2)
 {
   loc temp;


   temp.longitude = op2.longitude + longitude;
   temp.latitude = op2.latitude + latitude;
   return temp;
 }

void main(void)
  {
   loc ob1(10,20), ob2( 1,1);

   ob1.show();
   ob1(7,8);
   ob1.show();
   ob1 = ob2 + ob1(10,10);
   ob1.show();
  }

⌨️ 快捷键说明

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