由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - virtual function question
相关主题
C++ virtual function 定义在 derived class 会怎么样?C++: friend function
[合集] can destructor be pure virtual function in c++?interview question: make all class member functions virtual (转载)
friend function 不能virtual 怎么搞呢?问题:vptr/vtable for virtual function & vptr/vtable for
请问c++中操作符可以声明为虚函数吗?C++中virtual function的性能差是个误解
弱问一个virtual function的问题[合集] C++ virtual function的一个问题。。
请教一个class design的问题[合集] C++: Call virtual function in a constructor.
问一个问题。。C++ questions
How to check the virtual function table size?听说pointer to member function只支持最多128个virtual functi
相关话题的讨论汇总
话题: vf1话题: virtual话题: int话题: here话题: different
进入Programming版参与讨论
1 (共1页)
c****l
发帖数: 1280
1
HERE IS a slide of my previous course. but i got lost here. any one can help
? thanks
Virtual functions:
s***e
发帖数: 122
2

struct Derived 3 : public Derived 2{
virtual int vf2 (int);
// diferent from vf1!
==============
WHY DIFFERENT? WHY SHOULD BE CAREFUL HERE? I AM LOST
================
they are different because they have different name.
be careful because this vf1() has different signature than vf1() derived
from its superclass: int vf1(int) <=> int vf1(void), so it's a new function.
i personally think they have nothing to do with virtual functions, but trick
things.
================
virtual int vf1 (int); // B

【在 c****l 的大作中提到】
: HERE IS a slide of my previous course. but i got lost here. any one can help
: ? thanks
: Virtual functions:

d******n
发帖数: 42
3
they take different arguments, they are different functions. so vf1(int)
does not overload vf1()
1 (共1页)
进入Programming版参与讨论
相关主题
听说pointer to member function只支持最多128个virtual functi弱问一个virtual function的问题
问个C++ virtual function的问题 (转载)请教一个class design的问题
Can we define pure virtual function? (转载)问一个问题。。
inline functions in C++How to check the virtual function table size?
C++ virtual function 定义在 derived class 会怎么样?C++: friend function
[合集] can destructor be pure virtual function in c++?interview question: make all class member functions virtual (转载)
friend function 不能virtual 怎么搞呢?问题:vptr/vtable for virtual function & vptr/vtable for
请问c++中操作符可以声明为虚函数吗?C++中virtual function的性能差是个误解
相关话题的讨论汇总
话题: vf1话题: virtual话题: int话题: here话题: different