Click here to Skip to main content
15,919,613 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Error ? Pin
Branislav10-Mar-05 1:31
Branislav10-Mar-05 1:31 
GeneralRe: Error ? Pin
Larsson10-Mar-05 2:37
Larsson10-Mar-05 2:37 
GeneralRe: Error ? Pin
Branislav10-Mar-05 3:32
Branislav10-Mar-05 3:32 
GeneralRe: Error ? Pin
Branislav10-Mar-05 3:34
Branislav10-Mar-05 3:34 
AnswerRe: Error ? Pin
ThatsAlok10-Mar-05 1:40
ThatsAlok10-Mar-05 1:40 
GeneralRe: Error ? Pin
Larsson10-Mar-05 2:34
Larsson10-Mar-05 2:34 
GeneralC++ HELL Pin
vikramlinux9-Mar-05 22:43
vikramlinux9-Mar-05 22:43 
GeneralRe: C++ HELL Pin
Steen Krogsgaard9-Mar-05 23:38
Steen Krogsgaard9-Mar-05 23:38 
In your example I don't think two vtables are needed. Generally, you need two vtables if the derived class overrides the same function in more than one baseclass:
<br />
class Base1<br />
{<br />
public<br />
virtual void func1(void);<br />
virtual void funcCommon(void);<br />
}<br />
<br />
class Base2<br />
{<br />
public<br />
virtual void func2(void);<br />
virtual void funcCommon(void);<br />
}<br />
<br />
class Derived : public Base1, public Base2<br />
{<br />
public<br />
virtual void func3(void);<br />
virtual void funcCommon(void); // <-- requires two vtables <br />
}<br />


The reason for the two vtables is to make Derived act as both a Base1 and a Base2:
<br />
Base1* pB1;<br />
Base2* pB2;<br />
Derived d;<br />
pB1 = &d;<br />
pB1->funcCommon() // calls Derived1::funcCommon<br />
pB2 = &d;<br />
pB2->funcCommon() // also calls Derived2:funcCommon, but through second vtable in Derived<br />


See also the article "C+: under the hood" by Jan Gray in MSDN.

Cheers
Steen.

"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
GeneralRedirecting console app output with immediate message delivery Pin
Member 17922589-Mar-05 21:48
Member 17922589-Mar-05 21:48 
GeneralChange output directory Pin
doctorpi9-Mar-05 21:22
doctorpi9-Mar-05 21:22 
GeneralRe: Change output directory Pin
Steen Krogsgaard9-Mar-05 22:16
Steen Krogsgaard9-Mar-05 22:16 
GeneralRe: Change output directory Pin
doctorpi9-Mar-05 22:20
doctorpi9-Mar-05 22:20 
GeneralRe: Change output directory Pin
Steen Krogsgaard9-Mar-05 22:24
Steen Krogsgaard9-Mar-05 22:24 
QuestionHow to access VB ActiveX dll from Win32 dll from VC++ Pin
gayanperera9-Mar-05 21:06
gayanperera9-Mar-05 21:06 
Generalfile in window Pin
Member 299699-Mar-05 20:43
Member 299699-Mar-05 20:43 
GeneralRe: file in window Pin
gamitech9-Mar-05 21:08
gamitech9-Mar-05 21:08 
GeneralControl panel applet icon Pin
sunilkumar_prog9-Mar-05 20:15
sunilkumar_prog9-Mar-05 20:15 
GeneralRe: Control panel applet icon Pin
David Crow10-Mar-05 5:18
David Crow10-Mar-05 5:18 
GeneralRe: Control panel applet icon Pin
sunilkumar_prog12-Mar-05 0:49
sunilkumar_prog12-Mar-05 0:49 
GeneralhDC,undeclared identifier error Pin
Member 16927359-Mar-05 20:03
Member 16927359-Mar-05 20:03 
GeneralRe: hDC,undeclared identifier error Pin
Branislav10-Mar-05 0:28
Branislav10-Mar-05 0:28 
GeneralHi... Great People.... Pin
deldeep9-Mar-05 19:16
deldeep9-Mar-05 19:16 
GeneralRe: Hi... Great People.... Pin
Tareq Ahmed Siraj9-Mar-05 20:11
Tareq Ahmed Siraj9-Mar-05 20:11 
GeneralRe: Hi... Great People.... Pin
deldeep11-Mar-05 18:42
deldeep11-Mar-05 18:42 
GeneralReadDebuggeeMemory Pin
Aleksan9-Mar-05 19:16
Aleksan9-Mar-05 19:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.