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

📄 mainprogram.cpp

📁 C++编成数据结构与程序设计方法 D.S.Malk编著
💻 CPP
字号:
//Chapter 13: Virtual Functions and value parameters

#include <iostream>

#include "derivedClass.h"

using namespace std;

void callPrint(baseClass p);

int main()
{
    baseClass one(5);                       //Line 1
    derivedClass two(3, 15);                //Line 2

    one.print();                            //Line 3
    two.print();                            //Line 4

    cout << "*** Calling the function "
        << "callPrint  ***" << endl;        //Line 5

    callPrint(one);                         //Line 6
    callPrint(two);                         //Line 7

    return 0;
}

void callPrint(baseClass p)  //p is a value parameter
{	
    p.print();
}

⌨️ 快捷键说明

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