Re: Some Qs related to VTable and DialogBox!

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"RajanM" <Rajan.Munuswamy@xxxxxxxxx> wrote in message
news:1169562128.281283.199840@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#include<iostream>
using namespace std;

class A{
virtual void VFunc(){cout<<"VFun of Class A\n";}
};

class B:public A{ };

int main()
{
A *pa;
pa = new B ;
pa->VFunc(); //This calls Class A's VFunc
// here, Does the compiler might have created VTable for Class B or
not?

return 0;
}


Sure, of course the VTable has been created for Class B. Otherwise how
would the call pa->VFunc() correctly call A::VFunc()?


----------------
Q2: Does virtual functions have any effect wiht access specifiers?
Meaning in the above example, is it ok to put my base class virtual
function in private?

You could just try it... if you make A::VFunc() private, then you won't be
able to call it from main().


----------------------------
Q3: How to add a StatusBar containing progress bar, in a Dialog box?


Perhaps CodeProject/Codeguru has examples of this. I imagine you use
CStatusBarCtrl.


-- David (MVP)


.



Relevant Pages

  • random number code
    ... Will it really compile exactly the same as mingw compiler used ... // initialization of static private members ... MSBs of the seed affect only MSBs of the array ... // constructor with 32 bit int as seed ...
    (comp.lang.cpp)
  • Re: C++ in ternms of C
    ... int b, c, d; ... To consider the other aspects of OOP, we obviously have public, private and ... In short, imagine the compiler ripping all of the functions out of a class, ... I tried to analise the ASM file produ ced my the VC++ compil er. ...
    (microsoft.public.vc.language)
  • Re: question
    ... >class A(const int l) ... show us the same code that your compiler saw if you tell us about an error ... so it wouldn't accept a subsequent definition of an A object ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Should public virtual always become private virtual? & using private inheritance
    ... > are private in the base, ... > Should the compiler complain that foo is private in D? ... The compiler should complain that foo is private in D. ... Access to virtual functions ...
    (comp.lang.cpp)
  • Re: Should public virtual always become private virtual? & using private inheritance
    ... > are private in the base, ... > Should the compiler complain that foo is private in D? ... The compiler should complain that foo is private in D. ... Access to virtual functions ...
    (comp.object)