When I compile this:
------foo.cc----------
class I1
{
public:
virtual void a() = 0;
};
class C1 : public I1
{
public:
void a()
{
}
};
class I2 : public I1
{
public:
virtual void b() = 0;
};
class C2 : public I2, public C1
{
public:
void b()
{
}
};
int main(int argc, char *argv[])
{
C2 sc;
return 0;
}
---------------------
$ g++ -c -g foo.ccfoo.cc: In function ‘int main(int, char**)’:
foo.cc:33: error: cannot declare variable ‘sc’ to be of abstract type ‘C2’
foo.cc:24: note: because the following virtual functions are pure
within ‘C2’:
foo.cc:5: note: virtual void I1::a()
I would think that I1::a() is not virtual because it is defined in the
super class C1. What is going on here?
$ g++ --version
g++ (GCC) 4.1.2 20070502 (Red Hat 4.1.2-12)
Same results for:$ ~/gccsvn/native-clean/gcc/xgcc
-B/home/daney/gccsvn/native-clean/gcc/ --version
xgcc (GCC) 4.3.0 20070728 (experimental)
David Daney