Click to See Complete Forum and Search --> : virtual function


ruhail
May 31st, 2002, 12:26 PM
Can a virtual function be made static. An example would help

Thanks,
ruhail

Manorama
May 31st, 2002, 12:44 PM
When u say function as virtual , the function should be used for
the derived class and as well as the class in which the function
is there. But when u say about 'static' it is only for particular
class. and it is class dependent. So static function cannot
be virtual.
Bye
manu

doggyzone
June 1st, 2002, 10:49 AM
as we all know, a "virtual" function is stored in the scope of its object as a function pointer(vptr), and so it's obvious that it cannot be a static one, for a static function must be stored out of the scope of objects so as to be referenced without the prefix of object name.
that's all what i know.

Jupiter
June 2nd, 2002, 07:57 PM
Hi
NO! Virtual function can not be made static. Static functions or members are class lavel functions or variables and they are called independant of object.

vaninagam
June 3rd, 2002, 02:21 AM
No.We can not make a virtual function as static .