Hello fellow C++ experts,
is there any dramatic difference between multiple inheritance:
struct MyType4 : MyType1, MyType2, MyType3 {
int MyInt;
};
and:
struct MyType4 {
MyType1 MyObject1;
MyType2 MyObject2;
MyType3 MyObject3;
int MyInt;
};
?
Is just neat sintactic sugar, or is there something that is impossible
to be achieved with the 2nd solution?
I mean, a function accepting a pointer to MyType2 can accept also a
pointer to a MyType4 object, and that's neat, but I could always pass
&MyObject4.MyOb ject2 to that function (2nd solution without multiple
inheritance), producing the same result (at least I think). Hence my
question "Is just neat sintactic sugar, or..".
Thanks,
Mike 2 1392 mi**@nospam.com wrote:
Hello fellow C++ experts,
is there any dramatic difference between multiple inheritance:
struct MyType4 : MyType1, MyType2, MyType3 {
int MyInt;
};
and:
struct MyType4 {
MyType1 MyObject1;
MyType2 MyObject2;
MyType3 MyObject3;
int MyInt;
};
?
Is just neat sintactic sugar, or is there something that is impossible
to be achieved with the 2nd solution?
I mean, a function accepting a pointer to MyType2 can accept also a
pointer to a MyType4 object, and that's neat, but I could always pass
&MyObject4.MyOb ject2 to that function (2nd solution without multiple
inheritance), producing the same result (at least I think). Hence my
question "Is just neat sintactic sugar, or..".
You can't implement virtual functions for MyTypes 1-3 in MyType4
without inheritance. Check out: http://www.parashift.com/c++-faq-lit....html#faq-25.4
Cheers! --M
mlimber wrote:
mi**@nospam.com wrote:
Hello fellow C++ experts,
is there any dramatic difference between multiple inheritance:
struct MyType4 : MyType1, MyType2, MyType3 {
int MyInt;
};
and:
struct MyType4 {
MyType1 MyObject1;
MyType2 MyObject2;
MyType3 MyObject3;
int MyInt;
};
?
Is just neat sintactic sugar, or is there something that is impossible
to be achieved with the 2nd solution?
I mean, a function accepting a pointer to MyType2 can accept also a
pointer to a MyType4 object, and that's neat, but I could always pass
&MyObject4.MyOb ject2 to that function (2nd solution without multiple
inheritance), producing the same result (at least I think). Hence my
question "Is just neat sintactic sugar, or..".
You can't implement virtual functions for MyTypes 1-3 in MyType4
without inheritance. Check out:
http://www.parashift.com/c++-faq-lit....html#faq-25.4
See also FAQs 24.2 and 24.3.
Cheers! --M This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rolf Wester |
last post by:
Hi,
I have a form with a select element with multiple="true". When using the
GET method (I suppose the same happens with the POST method) I can seen
that the form sends channels=CH1&channels=CH2 when CH1 and CH2 have been
choosen. $_GET gives me "CH2". Is there any way to get all
the choosen channels elements? I would be very appreciative for any
help. Thank you in anticipation.
Regards
|
by: Darren Dale |
last post by:
Hello,
def test(data):
i = ? This is the line I have trouble with
if i==1: return data
else: return data
a,b,c,d = test()
|
by: Ohaya |
last post by:
Hi,
I'm trying to understand a situation where ASP seems to be "blocking" of
"queuing" requests. This is on a Win2K Advanced Server, with IIS5.
I've seen some posts (e.g.,
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=Tidy7IDbDHA.2108%40cpmsftngxa06.phx.gbl)
that indicate that ASP will queue up requests when they come in with the
same "session".
|
by: Ben Hallert |
last post by:
Hi guys,
I'm trying to figure out what bone headed mistake I made on something I
put together. I've got a form (named 'context') that has a variable
number of select-multiple inputs on it. Based on the number of
variables passed through a GET string, I want to multiply the total
number of selected items for each together to see how many possible
combinations the selected items are generating.
The following snippet of code...
|
by: Abhishek Srivastava |
last post by:
Hello All,
In IIS 6.0 We have a concept of worker processes and application pools.
As I understand it, we can have multiple worker process per appliction
pool. Each worker process is dedicated to a pool. If I assign only one
application to a applicaton pool and have multiple worker processes
assigned to that pool. Will my application be processed by many worker
processes?
| |
by: Graham |
last post by:
I have been having some fun learning and using the new Controls and methods in .Net 2.0 which will make my life in the future easier and faster. Specifically the new databinding practises and wizards.
But, I have found that trying to do something "outside the norm" adds a rather large level of complexity and/or data replication.
Background
I have been commissioned to create a web-based application for a client. It has a formsaunthentication...
|
by: areef.islam |
last post by:
Hi, I am kinda new to javascript and I am having this problem with
selecting multiple options from a select tag. Hope someone can help me
out here.
here is my code
///////////////////////////////////////////////////////////////////////////////////////
<form action="whatever.php" method="post">
<select name="zip_code"
onchange="makeRequest('getCity.php?state='+this.form.zip_code.options.value)"
multiple="multiple" size="20">
|
by: abhishekhs |
last post by:
Hi all
I have more than one multiple select lists in a page. Something like this
<tr>
<td>
<select NAME="StrainList" ID="StrainList" SIZE="5" multiple="multiple" style="width: 150px">
<?
for ($i=0; $i < $rows; $i++)
|
by: keerthyragavendran |
last post by:
hi
i'm downloading a single file using multiple threads...
how can i specify a particular range of bytes alone from a single
large file... for example say if i need only bytes ranging from
500000 to 3200000 of a file whose size is say 20MB...
how do i request a download which starts directly at 500000th byte...
thank u
cheers
|
by: bonneylake |
last post by:
Hey Everyone,
Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also the parts section an i seem to be having trouble.
When i try to insert into the parts section i get the error Invalid character value for cast specification. But not sure what i am doing wrong. Here is what i am using to insert. All the sections...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |