I'm using interfaces in C++ by declaring classes with only pure virtual
methods. If then someone wants to implement the interface they
needs to inherit from the class. If the implementing class forgets to
implement some method I normally get a compile error(if the class is created
in some way of course). When using the Visual
Studio 6 compiler however, it does not generate a compile error in this
case:
- I have a implementing class A that inherits from an interface class. It
has not implemented all methods.
- The implementing class A is declared as an array in a container class. The
container class is created with new.
The compiler do not generate any errors, but I will of course get a runtime
error when a method with no implementation is called("pure function call" or
something). If the container class declares A as a pointer(and performs new
on it) or as a non-array variable, then the compiler generates compile
errors, but not if it is declared as an array.
So, my question is: is it a compiler fault, if it does not find out that an
abstract class is created(which is the case here since all methods are not
implemented)? Or should it be considered as normal that the compiler can not
find out cases like this(i.e more complicated cases).
/Bjorn