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

📄 questface.h

📁 C++&datastructure书籍源码,以前外教提供现在与大家共享
💻 H
字号:
#ifndef _QUESTIONTERFACE_H
#define _QUESTIONTERFACE_H

// abstract base class for quiz questions
// derived classes MUST implement four functions:
//
// void Ask()        to ask the question
// string Answer()   to return the answer
// bool IsCorrect(s) to tell if an answer s is correct
// void Create()     to create a new question
//
// This class conforms to the naming conventions
// of quiz questions in "A Computer Science Tapestry" 2e

#include <string>
using namespace std;

class Question
{
  public:
    virtual ~Question() { }   // must implement destructor, here inline
    
    // accessor functions
    
    virtual bool    IsCorrect(const string& answer)  const = 0;
    virtual string  Answer()                         const = 0;
    virtual void    Ask()                            const = 0;
    
    // mutator functions
    
    virtual void Create() = 0;
};

#endif

⌨️ 快捷键说明

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