static_cast
and void
pointers. I have a class DynamicallyTyped
which returns upon request a pointer to the desired data type. This is like implementing "virtual void*
" but for data types, rather than for function pointers.
|
|
virtual
(or some other technique)? Z.GetPolynomial()=X.GetPolynomial()+Y.GetPolynomial(); |
|
|
enum{typeError=-1, typeUndefined=0, typeIntegerOrIndex, typeRational, typeLieAlgebraElement, typePoly, ...
Z.GetPolynomial()=X.GetPolynomial()+Y.GetPolynomial();