CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2001
    Posts
    17

    virtual function

    Can a virtual function be made static. An example would help

    Thanks,
    ruhail

  2. #2
    Join Date
    Oct 2001
    Posts
    6

    about virtual

    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

  3. #3
    Join Date
    Jun 2002
    Posts
    2

    Angry no!

    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.
    No one knows u r a doggy through Internet!

  4. #4
    Join Date
    Apr 2002
    Location
    Tokyo
    Posts
    14
    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.

  5. #5
    Join Date
    Jun 2002
    Location
    bangalore
    Posts
    10
    No.We can not make a virtual function as static .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured