抽象基类可以有V表吗?将虚拟析构函数的指针输入到虚拟表中吗? [英] Can abstract base class have V-table?, Will the pointer to virtual destructor be entered into the virtual table?
问题描述
大家好,
我是c ++的新手......我对虚拟有些怀疑主题。
1)抽象基类可以有V表吗?
这里的方式,
类CTemp {
CTemp(){};
~CTemp(){};
>
虚拟空白显示()= 0;
虚拟空白绘制(){cout<< "它准备就绪!! << endl;}
}
Class CDerived:public 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
推荐答案
Sojin
Sojin
这个[抽象]类CTemp可以有一个v表吗?
Ctemp类没有他的类型的对象,因为它是虚拟的,
因此如果没有类没有v-table?对?或者不是我
了解你的问题?
2.虚拟析构函数是否会进入虚拟表?
Can this [abstract] class CTemp have a v-table?
Class Ctemp cannot have an object of his type since it is virtual,
hence if there is no class there is no v-table? Right? Or do not I
understand your question?
2. Will the virtual destructor be entered into the virtual table?
但你还没有声明析构函数是虚拟的?
Marc Wentink
But you have not declared the destructor virtual to start with?
Marc Wentink
sojin写道:
大家好,
我是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?
Yes
2) Will the virtual destructor be entered into the virtual table?
Yes
please give me good directions..
With rgds
soj
>
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 that
at least on entry for a function is zero.
这篇关于抽象基类可以有V表吗?将虚拟析构函数的指针输入到虚拟表中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!