the following is a theoretical question, this code does not compile in
visual c++ so
my question is, considering c++ virtual inheritance mechanism how many
copies of V is D suppose to have?
class V{virtual f()};
class B1:public virtual V{...};
class B2:public virtual V{...};
class C:public B2, public virtual V{...};
class D: public virtual B1,public virtual B2,public virtual C{...},public
V{...};
thank you
Liz 4 4283
anat wrote: the following is a theoretical question, this code does not compile in visual c++ so my question is, considering c++ virtual inheritance mechanism how many copies of V is D suppose to have?
One. That is the whole idea.
--
WW aka Attila
anat wrote: the following is a theoretical question, this code does not compile in visual c++ so my question is, considering c++ virtual inheritance mechanism how many copies of V is D suppose to have?
class V{virtual f()}; class B1:public virtual V{...}; class B2:public virtual V{...}; class C:public B2, public virtual V{...}; class D: public virtual B1,public virtual B2,public virtual C{...},public V{...};
Two. One virtual (inherited from the various bases) and one non-virtual.
--
Pete Becker
Dinkumware, Ltd. ( http://www.dinkumware.com)
Pete Becker wrote: anat wrote: the following is a theoretical question, this code does not compile in visual c++ so my question is, considering c++ virtual inheritance mechanism how many copies of V is D suppose to have?
class V{virtual f()}; class B1:public virtual V{...}; class B2:public virtual V{...}; class C:public B2, public virtual V{...}; class D: public virtual B1,public virtual B2,public virtual C{...},public V{...};
Two. One virtual (inherited from the various bases) and one non-virtual.
Ahh! I have missed that public V. There is a {} before it, that made me
think this is the end of the declaration of the base classes. And I am not
mistaking it will do that to a compiler, too. :-)
--
WW aka Attila
On Mon, 15 Sep 2003 00:36:52 +0200 in comp.lang.c++ :
I took the liberty to change your example to below:
class V{
public:
V() { std::cout << "V\n"; }//virtual int f();
};
class B1:public virtual V
{
public:
B1() { std::cout << "B1\n"; }
};
class B2:public virtual V
{
public:
B2() { std::cout << "B2\n"; }
};
class C:public B2, public virtual V
{
public:
C() { std::cout << "C\n"; }
};
class D:public virtual B1,public virtual B2,
public virtual C,public V
{
public:
D() { std::cout << "D\n"; }
};
int main()
{
D d;
return 0;
}
compiler results:
warning: direct base `B2' inaccessible in `D'
due to ambiguity
warning: direct base `V' inaccessible in `D'
due to ambiguity
output:
V
B1
B2
B2
C
V
D This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matt |
last post by:
I have created an MDI child form that I am using as a base form in a VB.Net
MDI application. The base MDI child form has a series of menu options on
it. I then use this form to create other MDI...
|
by: Jason Hickey |
last post by:
Has there been a change in the way the UI designer handles winform
inheritance in the 2003 version of visual studio.
Consider the following (try it if you are using 2003 Everything seems to
work...
|
by: Elhanan |
last post by:
hi all
i have a question in desgning a form..
the application in question is something a indexing station.
the user in this indexing station views a document in pdf/tiff format
on the right...
|
by: Paul M |
last post by:
Hi folks,
I've got a page that contains the basic formatting that I need for pretty
much all of my systems pages. It's compiled into it's DLL, distributed to
my application's \bin folder and VS...
|
by: Mr Wizard |
last post by:
I am going through the front controller http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpatterns/html/ImpFrontControllerInASP.asp and all works well except when the server.transfer...
|
by: Gopal Prabhakaran |
last post by:
Hi
Pls Help me to do Visual Inheritance with ASP.NET
--
Thanx
Gopal Prabhakaran
|
by: VR |
last post by:
Hi, I read about Master Pages in ASP.Net 2.0 and after implementing some
WinForms Visual Inheritance I tryed it with WebForms (let's say .aspx pages,
my MasterPage does not have a form tag itself...
|
by: Bart Schelkens |
last post by:
Hi,
i've created a base-form from which all the forms in my application need to
inherit.
This works just fine.
I've put some buttons on my base-form.
They are displayed correctly, only if my...
|
by: Ray Cassick \(Home\) |
last post by:
Since I got such good feedback from the Xml comments question I will ask
this of the group as well.
Is VS.NET 2005 handling the visual inheritance problems centered around
controls and forms...
|
by: Dino Buljubasic |
last post by:
Hi,
I am thinking of using visual inheritance. I am using C# VS 2005. I
am concerned about how good it is. I have heard about problems like
controls dissapearing or so.
Any hints, tips,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |