Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Virtual and Pure Virtual functions.

Virtual and Pure Virtual functions.

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Neelesh K J Jain
    wrote on last edited by
    #1

    Hello Friends, I have a doubt. See the following code. class Example { public: virtual void show() { cout<<"Base class Show"; } virtual void display() = 0; virtual void disp() = 0; }; When the object of its derived class object is created. In the V-Table, what will be the order of the virtual function. Whether the normal virtual function will be placed first and then the pure virtual function or else, it depends upon the order used in declaring them in the class. Thanks in advance. Neelesh K J Jain.

    T S 2 Replies Last reply
    0
    • N Neelesh K J Jain

      Hello Friends, I have a doubt. See the following code. class Example { public: virtual void show() { cout<<"Base class Show"; } virtual void display() = 0; virtual void disp() = 0; }; When the object of its derived class object is created. In the V-Table, what will be the order of the virtual function. Whether the normal virtual function will be placed first and then the pure virtual function or else, it depends upon the order used in declaring them in the class. Thanks in advance. Neelesh K J Jain.

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      why do you need such information ? isn't a function call based on its name and its atributes instead of its place in the virtual table ??


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      1 Reply Last reply
      0
      • N Neelesh K J Jain

        Hello Friends, I have a doubt. See the following code. class Example { public: virtual void show() { cout<<"Base class Show"; } virtual void display() = 0; virtual void disp() = 0; }; When the object of its derived class object is created. In the V-Table, what will be the order of the virtual function. Whether the normal virtual function will be placed first and then the pure virtual function or else, it depends upon the order used in declaring them in the class. Thanks in advance. Neelesh K J Jain.

        S Offline
        S Offline
        S Senthil Kumar
        wrote on last edited by
        #3

        It usually is in the same order as you declare, but it's not required to by the C++ standard. In fact, the standard doesn't talk about object layout at all. AFAIK, COM relies on the ordering of functions in the vtable, so I guess the VC++ compiler must put them in the same order as you declare. Regards Senthil _____________________________ My Blog | My Articles | WinMacro

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups