类继承
从一个类派生出另一个类时,原始类称为基类,继承类称为派生类。
为说明继承,首先需要一个基类。
创造并简单的使用一个派生类
//ss.h
#ifndef MYTIME_H_
#define MYTIME_H_
#include<string>
class Table
{
//simple base class
private:
std::string firstname;
std::string lastname;
bool hasTable;
public:
Table(const std::string& fn = "none", const std::string& ln = "none",
bool ht = false);
void Name() const;
bool HasTable() const {
return hasTable; }
void ResetTable(bool v) {
hasTable = v; }
};
//simple derived class
class RatedPlayer : public Table
{
private:
unsigned int rating;
public:
RatedPlayer(unsigned int r = 0,</