关于c ++中抽象基类的问题

Sno*_*man 0 c++ polymorphism

假设类stringGetter只包含一个纯虚函数:重载的运算符,字符串运算符()(int x).还假设类getPageString是一个实现operator()的公共stringGetter.

以下哪个C++语句肯定会导致编译器错误?

(a) stringGetter * a = new stringGetter;
(b) stringGetter * a = new getPageString;
(c) stringGetter * a;
getPageString * b = new getPageString;
a=b
(d) Exactly two of these will result in a compiler error.
(e) It is possible that none of these will result in a compiler error.
Run Code Online (Sandbox Code Playgroud)

我对抽象基类有点模糊,我无法在网上找到像下面那样进行分配的好例子.我喜欢在这里询问关于这类东西的问题,因为我经常学到更多关于我甚至不打算学习的东西.我甚至无法猜测这些会导致编译器错误.任何人都可以通过交流,告诉我为什么或为什么不会导致编译错误?

Mah*_*esh 8

(a) 结果编译器错误,因为无法为抽象类创建实例.