Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

15.9节AndQuery和OrQuery是抽象基类么 #84

Open
CruzLi opened this issue Jun 27, 2018 · 1 comment
Open

15.9节AndQuery和OrQuery是抽象基类么 #84

CruzLi opened this issue Jun 27, 2018 · 1 comment

Comments

@CruzLi
Copy link

CruzLi commented Jun 27, 2018

AndQuery和OrQuery都继承了BinaryQuery的rep纯虚函数,由抽象基类的概念定义,这两个类应该是抽象基类把?

@ghost
Copy link

ghost commented Feb 24, 2020

《C++ Primer 5th》中文版

含有(或者未经覆盖直接继承)纯虚函数的类是抽象基类。p541

BinaryQuery不定义eval,而是继承了该纯虚函数。因此,BinaryQuery也是一个抽象基类,我们不能创建BinaryQuery类型的对象。 p570

class AndQuery:public BinaryQuery{ //p570
    //...
    //具体的类:AndQuery继承了rep并且定义了其他纯虚函数
    QueryResult eval(const TextQuery&)
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant