www.digitalmars.com         C & C++   DMDScript  

c++ - abstract class as virtual base class

struct A
{
  virtual void f()
  { }
};

struct B
  : public A
{
  virtual void g() = 0;
};


struct D
  : public virtual B
{
  virtual void g()
  { }
};

struct E
  : public virtual B, public D
{ };


int main()
{
  E e;
  // Error: cannot create instance of abstract class 'E'

  return 0;
}


It works if I change the definition of E to:

struct E
  : public D, public virtual B
{ };

which makes it a low-priority bug.


bye, Christof

-- 
http://cmeerw.org                                 JID: cmeerw jabber.at
mailto cmeerw at web.de

...and what have you contributed to the Net?
Dec 26 2002