Template base delegation

  • Authors:
  • Ted Law

  • Affiliations:
  • IBM Software Solutions Toronto Laboratory, North York, Ontario, Canada

  • Venue:
  • CTEC'94 Proceedings of the 6th conference on USENIX Sixth C++ Technical Conference - Volume 6
  • Year:
  • 1994

Quantified Score

Hi-index 0.00

Visualization

Abstract

When a class derives from a template instantiation, the base class is called a template base class. Non-template base classes are more commonly used, but do not take into account the specific needs of the derived class. The base class can provide better service; it can be customized by becoming a template instantiation using the derived class and/or other classes as arguments. In this way, the template base class can tailor-make itself for the derived class, taking advantage of the knowledge of its type. For example, the template base class can type its methods appropriately for the derived class. Furthermore, inheriting publicly from a template base class makes it possible for the derived class to delegate part of its public type-specific interface to the base. This paper explores the advantages of template base delegation.