sojin写道:sojin wrote:大家好, 我是c ++的新手。 ..我对虚拟有疑问主题。 1)抽象基类可以有V表吗? 这里就是这样的, 类CTemp { CTemp(){}; ~CTemp(){}; 虚拟空白显示()= 0; 虚拟空白绘制(){cout<< "它准备就绪!! <<结束;} 类CDerived:公共CTemp { CDerived(){}; ~CDerived(){}; 这个类CTemp可以有一个v表吗? 2)虚拟析构函数是否会进入虚拟表? 使用rgds soj Hi all, I''m a new to c++... and I''ve some doubts on "virtual" topics. 1) Can abstract base class have V-table? Here''s the way,, Class CTemp{ CTemp(){}; ~CTemp(){}; virtual void display() = 0; virtual void draw() { cout << " It''s ready!!" << endl;} } Class CDerived : public CTemp{ CDerived(){}; ~CDerived(){}; } Can this class CTemp have a v-table? 2) Will the virtual destructor be entered into the virtual table? please give me good directions.. With rgds soj 是的,即使该类是抽象的,它确实有一个vtable,在那个 至少在进入函数时是零。 yes even though the class is abstract it does have a vtable, in thatat least on entry for a function is zero. 这篇关于抽象基类可以有V表吗?将虚拟析构函数的指针输入到虚拟表中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-18 15:56