Re: Undefined reference to...
* Andrea Crotti, on 10.11.2010 18:22:
Andrea Crotti<andrea.crotti.0@gmail.com> writes:
The other class is by the way
class Beacon : public Packet, public Serializable
is it possible that multiple inheritance makes things harder in this case?
Ok apparently I got it, if I don't implement something it doesn't work
That seems to be a correct assessment. Non-implemented features don't work.
With this is fine
virtual void writeBuffer() {}
If you say so.
With this stupid example I clarified my mind
class Base
{
public:
Base() {}
virtual void printOut();
};
class Extended : public Base
{
public:
Extended() {}
void printOut() { cout<< "hello"; }
};
Good. A clear mind is very nice.
(like this it doesn't work).
Parse error. Something is like something, and something does not work. What are
you talking about?
Would be best to have
virtual void writeBuffer() = 0
Sure, but where and for what?
to make it abstract, BUT then I have a static function that would
construct an object of subclass of Packet. IF there is a pure function
in the class definition than I'm not allowed to return a Packet (even if
I know that it will be always a subclass of it).
Right, you can't have an object where the most derived type is abstract.
Now way to force the compiler about that?
No.
And also, why the hell just declaring it and implementing it in every
subclass doesn't work?
Parse error again.
I mean the compiler should see it's actually implemented everywhere, so
what's the problem?
Well, that's what I'm wondering: what is the problem you're talking about?
Possibly I could find out by looking at your original posting.
But I don't think it's fair that I and other out to help you should do a lot of
work to figure out what you're talking about. Please try to convey what you're
talking about. "It doesn't work" out of context says nothing, in particular, "It
doesn't work" doesn't say what "It" is.
Cheers & hth.,
- Alf
--
blog at <url: http://alfps.wordpress.com>