help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

a question on virtual/multiple inheritance


From: Sergey Nikolenko
Subject: a question on virtual/multiple inheritance
Date: Tue, 5 Jul 2005 14:32:42 +0400

Dear all,

I have the following structure in my project:

class A
{
  public:
    A() { };
}

class B : virtual public A
{
}

class C : virtual public A
{
}

class D : public B, public C
{
  public:
    D() {};
}

class E : public D
{
  public:
    E(Something *s) : smth(s) {};

  private:
    Something *smth;
}

and this seems to work fine. However, as soon as I add another level
and rework the structure as follows:

class E : public D
{
  public:
    E() {};
}

class F : public E
{
  public:
    F(Something *s) : smth(s) {};

  private:
    Something *smth;
}


I begin getting cryptic error messages on the link phase like


general/lib.o(.gnu.linkonce.t._ZN15FC1EP14Something+0x16): In function
`F::F[in-charge](Something*)':
/usr/include/c++/3.3/bits/stl_algobase.h:538: undefined reference to `VTT for F'


Could somebody please explain what I'm doing wrong? Online manuals
don't seem to help as their chapters on virtual inheritance usually
end with the D class and do not go into F and E classes.

Thank you!

With best regards,
Sergey Nikolenko.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]