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

📄 prog14_03.cpp

📁 一本语言类编程书籍
💻 CPP
字号:
// Program 14.3 Overloading the copy assignment operator  File: prog14_03.cpp
#include <iostream>
#include <cstring>
using std::cout;
using std::endl;

#include "ErrorMessage.h"

int main() {
  ErrorMessage warning("There is a serious problem here");
  ErrorMessage standard;

  cout << endl << "warning contains - " << warning.what();
  cout << endl << "standard contains - " << standard.what();

  standard = warning;                               // Use assignment operator

  cout << endl << "After assigning the value of warning, standard contains - " 
       << endl << standard.what();

  cout << endl << "Resetting warning, not standard" << endl;
  warning.resetMessage();                           // Reset the Warning message

  cout << endl << "warning now contains - " << warning.what();
  cout << endl << "standard now contains - " << standard.what();
  cout << endl;

  return 0;
}

⌨️ 快捷键说明

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