Hi Naje,
>but then, i can't make Draw for another superclass,
You don't need a superclass for static polymorphism. The polymorphism is
in the template function.
The Draw template handles all objects that have the Draw method.
>but [heterogenous collections are] working in older versions of gcc, it's
working in gcc 3.3.3 but i can't assert error in compile time...
They shouldn't be.
But I think we have a semantic gap. You're speaking of static assertions,
not heterogeneous collections.
The assertion whether of not some object can perform the Draw action in
static polymorphism occurs during compilation, when/where the Draw(object)
template is instantiated, and the given object does not support the Draw
method.
The polymorphism is via the template. Just like std::vector is static
polymorphic container.
>...or maybe i don't understand meaning of world 'heterogenous'
std::vector<int> ... a homongeneous collection of objects
std::vector<Base*> ... a heterogeneous collection of objects (presuming
that derived classes are being put into the container). To work, the Base
object & those derived therefrom need to use a virtual method interface
specified in either the Base class (as an interface class), or in an
interface class inherited by the Base class and implemented in the derived
classes.
(Some hierarchies have the Base class as instantiable, other have
non-instantiable base classes. Hard to speak of both situations without a
lot of qualified answers.)
--Eljay