Thursday, June 30, 2011

Re: (PT) Want to understand the Diamond Problem.

 

HI Paul,
Thanks for your response. What I understood from the link is - If we use virtual inheritance, then we will have one copy of base class, but what is the internal representation in vtable so that it will be clear diagramatically.
Please help. 
regards - Ravi 
--- On Thu, 30/6/11, PJH <pauljherring@gmail.com> wrote:

From: PJH <pauljherring@gmail.com>
Subject: Re: (PT) Want to understand the Diamond Problem.
To: Programmers-Town@yahoogroups.com
Date: Thursday, 30 June, 2011, 9:49 PM

 

http://www.parashift.com/c++-faq-lite/multiple-inheritance.html#faq-25.8

On Thu, Jun 30, 2011 at 5:09 PM, Ravi Shankar <blr_ravi2006@yahoo.co.in>wrote:

> Hi All,

> As everyone knows about Diamond problem.Suppose we have class A with fun()

> as a member functionClass B and C are derived from Class A. Class D is

> derived from Class B and Class C. Now, if I create an object of class D and

> called fun() from the same object, then it will give compilation error of

> "ambiguity". So, we have to virtually inherited class B and C from A to

> resolve this problem.

> My doubt is -> How does it create one copy of fun() in D's object ? Can

> someone help me to understand how does it internally work ? For B and C,

> does it create a vptr for both the class ?

> Please help me to understand the same or guide me to understand it. regards

> -Ravi

>

> [Non-text portions of this message have been removed]

>

>

>

> ------------------------------------

>

> To unsubscribe : programmers-town-unsubscribe@yahoogroups.com

>

> Yahoo! Groups Links

>

>

>

>

--

PJH

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
To unsubscribe : programmers-town-unsubscribe@yahoogroups.com

.

__,_._,___

No comments: