people.h

来自「压缩包里有教材<<C++模式设计-基于QT4开源跨平台开发框架&gt」· C头文件 代码 · 共 43 行

H
43
字号
#include "qdatetime.h"class Person {public:    Person(QString name, QDate birthdate)    QObject(name.ascii()),    m_Birthdate(birthdate) {}    Person(const Person& p) : QObject(p),    m_Birthdate(p.m_Birthdate) {}private:    QDate m_Birthdate;};class Student : virtual public Person { /* note keyword virtual    here */    // other class members//end//start};class Teacher : virtual public Person { /* virtual inheritance    */    // other class members//end//start}class GraduateTeachingFellow :    public Student, public Teacher { /* virtual not needed        here */public:    GraduateTeachingFellow(const Person& p,                           const Student& s, const Teacher& t):    Person(p), Students(s), Teacher(t) {}     /*  It     is necessary to initialize all    virtual base classes explicitly in    multiply-derived classes, to resolve    ambiguity about how they should be    initialized. */}

⌨️ 快捷键说明

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