Forward Declared Template Use (Pointer)

Forward Declared Template Parameter

As with a typical circular-dependency break implemented with a forward declaration, this template-based example illustrates that the same is possible on a templated-type. Even though the declaration of MyType is used as part of the inheritance hierarchy, it is only a template type and not a base. Therefore the definition of MyType is still not required and a forward-declaration can be used. This is fairly straight forward so creating an example is relatively simple. Since the template instantiation only requires a MyType pointer, it can fulfill the requirements of the BaseType’s pointer member.