Click here to Skip to main content
15,907,326 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VS2005 toolbar messages Pin
Mark Salsbery2-Feb-08 7:45
Mark Salsbery2-Feb-08 7:45 
GeneralRe: VS2005 toolbar messages Pin
Davros2-Feb-08 8:08
Davros2-Feb-08 8:08 
GeneralRe: VS2005 toolbar messages Pin
Mark Salsbery2-Feb-08 8:18
Mark Salsbery2-Feb-08 8:18 
GeneralRe: VS2005 toolbar messages Pin
Davros3-Feb-08 0:15
Davros3-Feb-08 0:15 
GeneralRe: VS2005 toolbar messages Pin
Davros4-Feb-08 8:13
Davros4-Feb-08 8:13 
QuestionHow to run NT Service on Windows Vista Pin
Abhijit A2-Feb-08 0:12
Abhijit A2-Feb-08 0:12 
AnswerRe: How to run NT Service on Windows Vista Pin
Mark Salsbery2-Feb-08 7:52
Mark Salsbery2-Feb-08 7:52 
GeneralVirtual function and multiple inheritance Pin
George_George1-Feb-08 21:12
George_George1-Feb-08 21:12 
Hello everyone,


In the following multiple inheritance sample code, I have tested in class Derived, there are two __vfptr, pointing to the virtual function table for Foo and Goo repectively -- i.e. 8 bytes, 2 pointer on 32-bit machine.

My questions,

1. Why two __vfptr is needed? Why not just one?
2. class Derived has its own virtual method func2, why it does not have its own virtual function table pointer?


class Foo {
public:
	virtual int func() {return 1;};
};

class Goo {
public:
	virtual int func() {return 2;};
};

class Derived: Foo, Goo {
public:
	virtual int func2() {return 3;};
	int increase() {return -1;};
	int decrease() {return -2;};
};

int main()
{
	Derived d;
	int size;

	size = sizeof (d); // size is 8, two __vfptr?

	return 0;
}



thanks in advance,
George
GeneralRe: Virtual function and multiple inheritance Pin
Bram van Kampen1-Feb-08 22:50
Bram van Kampen1-Feb-08 22:50 
GeneralRe: Virtual function and multiple inheritance Pin
George_George1-Feb-08 23:14
George_George1-Feb-08 23:14 
QuestionCString::Empty() Pin
gReaen1-Feb-08 20:01
gReaen1-Feb-08 20:01 
GeneralRe: CString::Empty() Pin
John R. Shaw1-Feb-08 23:00
John R. Shaw1-Feb-08 23:00 
GeneralRe: CString::Empty() Pin
Bram van Kampen1-Feb-08 23:00
Bram van Kampen1-Feb-08 23:00 
GeneralRe: CString::Empty() Pin
CPallini2-Feb-08 5:13
mveCPallini2-Feb-08 5:13 
Questionhow to hide / show menubar in mfc mdi application? Pin
Prasann Mayekar1-Feb-08 19:14
Prasann Mayekar1-Feb-08 19:14 
Questionpicture box problem Pin
trioum1-Feb-08 18:23
trioum1-Feb-08 18:23 
GeneralRe: picture box problem Pin
Hamid_RT1-Feb-08 18:32
Hamid_RT1-Feb-08 18:32 
GeneralRe: picture box problem Pin
trioum1-Feb-08 23:36
trioum1-Feb-08 23:36 
GeneralRe: picture box problem Pin
Hamid_RT2-Feb-08 2:09
Hamid_RT2-Feb-08 2:09 
QuestionHow to share controls between property pages Pin
tigre2151-Feb-08 17:37
tigre2151-Feb-08 17:37 
AnswerRe: How to share controls between property pages Pin
Joan M2-Feb-08 5:04
professionalJoan M2-Feb-08 5:04 
GeneralRe: How to share controls between property pages Pin
tigre2154-Feb-08 8:13
tigre2154-Feb-08 8:13 
GeneralRe: How to share controls between property pages Pin
Joan M4-Feb-08 9:21
professionalJoan M4-Feb-08 9:21 
Questionhow to read windows2003 IPsec Settings Pin
jianxin08051-Feb-08 15:14
jianxin08051-Feb-08 15:14 
GeneralRunning Software on a remote machine Pin
Bram van Kampen1-Feb-08 14:44
Bram van Kampen1-Feb-08 14:44 

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.