#include <iostream>
class test {
virtual void func() = 0;
};
int main(){
test t[] = {};
return 0;
}
Above code will generate this compile time error:
error: array of abstract class type 'test'
However, it compiles if an array of pointers is used instead:
test* t[] = {};
Is it because pure virtual functions don't have a size yet so the compiler doesn't know how much space it should allocate? but pointers do have a size so it's fine?