Using the LSP and plain C++98:
template <int N> class C;
template <> class C<1> : public A {};
template <> class C<2> : public B {};
template <> class C<3> : public D {};
C<1> anInstanceOfA;
Since public inheritance in C++ satisfies the IS-A rule, anInstanceOfA
both IS-A C<1>
object and IS_AN A
object.