ch11cgolfer.cpp

来自「此例子是学习C++的好东西」· C++ 代码 · 共 33 行

CPP
33
字号
//Program 11-8 CGolfer   CGolfer is derived from CPerson

// File:  Ch11CGolfer.cpp

#include "Ch11CGolfer.h"
#include <iostream>
#include "Ch11CPerson.h"
using namespace std;

/*

CGolfer::CGolfer(string n, int a, int h) //Route 1 this inits all
{
	name = n;
	age = a;
	cout << "\nIn the CGolfer constructor \n";
	handicap = h;

}*/

CGolfer::CGolfer(string n, int a, int h) : CPerson(n, a) // Route 2 calls CPerson
{
	cout << "\nIn the CGolfer constructor \n";
	handicap = h;
}


void CGolfer::WriteGolfer()
{
	CPerson::WritePerson();
	cout << "\n Handicap:  " << handicap;
}

⌨️ 快捷键说明

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