class A { protected: A *inner; public: .... virtual void doSomething() = 0; .... } class B: public A { ... void doSomething() { if(inner != NULL) inner->doSomething(); } ... }
当我使用inner-> doSomething()时,我得到了一个分段错误.我应该怎么做才能在B类中调用inner-> doSomething()?
提前致谢.
A的适当构造函数如下
protected: A() : inner(NULL) { ... }