减少代码的重复

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;

class BasePage
{
public:
    void Header()
    {
        cout << "公共头部" << endl;
    }
};

class News : public BasePage
{

};

void test01()
{
    News news;
    news.Header();
}

int main()
{
    test01();
    system("Pause");
    return 0;
}

结果:

继承语法

 

相关文章:

  • 2021-07-26
  • 2022-12-23
  • 2021-10-06
  • 2021-12-25
  • 2021-10-23
  • 2021-06-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2021-11-14
  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案