Hey,
I'm a little new to c++ programming. I've created a class that inherits
from two other classes
class C: virtual public A, public B
{
...
}
now, the thing is, i have no clue what the classes A & B have in them,
i have no access to the source files. There're obviously some virtual
functions there; because i get
"no unique overrider.." errors for a multitude of functions in classes
A and B. I don't *want* to use the functions that have no unique
overriders; but i also can't go to single inheritance because i need
methods from both the classes.
any clues/explanations as to what is happening? I can't understand
this, and it's driving me crazy.
thanks. 6 2610 pa******@gmail.com wrote:
Hey,
I'm a little new to c++ programming. I've created a class that inherits
from two other classes
class C: virtual public A, public B
{
...
}
now, the thing is, i have no clue what the classes A & B have in them,
Yes you do, you must have their declarations in order to inherit from them.
i have no access to the source files. There're obviously some virtual
functions there; because i get
"no unique overrider.." errors for a multitude of functions in classes
A and B. I don't *want* to use the functions that have no unique
overriders; but i also can't go to single inheritance because i need
methods from both the classes.
I assume that error is telling you the classes have pure virtual methods
and you haven't implemented them in your class. You must.
--
Ian Collins.
Ian Collins wrote:
pa******@gmail.com wrote:
>Hey,
I'm a little new to c++ programming. I've created a class that inherits from two other classes
class C: virtual public A, public B { ... }
now, the thing is, i have no clue what the classes A & B have in them,
Yes you do, you must have their declarations in order to inherit from
them.
Ahem... "Definitions". Declarations are usually not enough.
[...]
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Victor Bazarov wrote:
Ian Collins wrote:
pa******@gmail.com wrote:
Hey,
I'm a little new to c++ programming. I've created a class that
inherits from two other classes
class C: virtual public A, public B
{
...
}
now, the thing is, i have no clue what the classes A & B have in
them,
Yes you do, you must have their declarations in order to inherit from
them.
Ahem... "Definitions". Declarations are usually not enough.
[...]
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
So yeah, I do have the declarations, but not the definitions. And
here's the annoying bit. The functions are implemented, because when i
inherit from only one class, the errors disappear; this leads me to
believe that both my A & B classes in turn inherit from another base
class. And they both have their own, different implementations of the
methods. Which is why the "unique bit in the error message. not to
bandy terms around or anything, but is this like the diamond
inheritance problem or something?
My last option would be to single inherit from one class, and just
rewrite code that i need from the other. pa******@gmail.com wrote:
Victor Bazarov wrote:
>>Ian Collins wrote:
>>>pa******@gmail.com wrote:
Hey,
I'm a little new to c++ programming. I've created a class that inherits from two other classes
class C: virtual public A, public B { ... }
now, the thing is, i have no clue what the classes A & B have in them,
Yes you do, you must have their declarations in order to inherit from them.
Ahem... "Definitions". Declarations are usually not enough.
So yeah, I do have the declarations, but not the definitions. And
here's the annoying bit. The functions are implemented, because when i
inherit from only one class, the errors disappear; this leads me to
believe that both my A & B classes in turn inherit from another base
class. And they both have their own, different implementations of the
methods. Which is why the "unique bit in the error message. not to
bandy terms around or anything, but is this like the diamond
inheritance problem or something?
Have you called A's constructor? I didn't spot the virtual inheritance
before.
Please trim signatures in your replies.
--
Ian Collins. pa******@gmail.com schrieb:
Hey,
I'm a little new to c++ programming. I've created a class that inherits
from two other classes
class C: virtual public A, public B
{
...
}
now, the thing is, i have no clue what the classes A & B have in them,
i have no access to the source files. There're obviously some virtual
functions there; because i get
"no unique overrider.." errors for a multitude of functions in classes
A and B.
Look for virtual functions in A, B or their bases, that have the same
name in the A family as in the B family. Then override the function in
class C (maybe a using; would be enough).
Pseudo code:
struct A
{
virtual void foo();
};
struct B
{
virtual void foo();
};
struct C : virtual public A, virtual public B
{
virtual void foo() { A::foo(); }
// or: using A::foo;
};
The compiler doesn't know what function it should put into the vtbl, so
it asks you to specify one.
--
Thomas pa******@gmail.com wrote:
Hey,
I'm a little new to c++ programming. I've created a class that inherits
from two other classes
class C: virtual public A, public B
{
...
}
now, the thing is, i have no clue what the classes A & B have in them,
Then you should not be using them. You could figure out what they have
in them, though, by reading their documentation, or, if there isn't any,
looking at the headers that define them. You cannot write sensible code
without that information. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mirek Rusin |
last post by:
....what is the best way to force duplicated unique
or primary key'ed row inserts not to raise errors?
duplicated rows can be ignored or updated as well
- it really doesn't matter.
to be...
|
by: Ulf Heyder |
last post by:
Hello everyone,
I want to add a unique constraint to a XSD I created.
After I modified validation (XMLSpy, Castor-0.9.5 marshaller) of my
example (see below) against the XSD (also see below)...
|
by: Thomas McK |
last post by:
Hi all, I'm not sure how to get around this, I was hoping someone
could provide me with some help. Let's take this simple data set of 2
columns in a table:
Tom - id1
Bob - id2
Jane - id1...
|
by: Jerry Camel |
last post by:
I need to be able to generate unique names for files. I was considering
that hash alogorithms, but if I had two files with the same name, I'd get
the same hash. I am collecting and storing files...
|
by: Jerry LeVan |
last post by:
Hi,
I am futzing around with Andrew Stuarts "Catchmail" program
that stores emails into a postgresql database.
I want to avoid inserting the same email more than once...
(pieces of the email...
| |
by: MonkeeSage |
last post by:
Here's yet another take on a unique() function for sequences. It's
more terse than others I've seen and works for all the common use
cases (please report any errors on the recipe page):
...
|
by: Phil Latio |
last post by:
I am inserting data into user table which contains 5 fields, sounds simple
enough normally but 2 of the fields are designated as UNIQUE. If someone
does enter a value which already exists, how do I...
|
by: shira |
last post by:
Hi,
Looking to see if someone might have an explanation for this behavior.
Is it a bug? Corruption?
I have been able to reproduce the problem with only 2 rows and 1
field. Here is the table:...
|
by: D.Stone |
last post by:
Hi, I'm getting hung up on a trivial schema change - I need to make a
column accept only null or unique values and Books Online avers 'what
you need is a UNIQUE constraint'. Fine.
I've tried...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |