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() |
|