| | | | | |

Adaptor Class

  • A classic example of has_a in OOP parlance
  • Changes (“adapts”) the public interface of another class
  • “Adaptee” -- the existing class being used
  • “Adaptor” -- the new class being defined
  • Uses protected object of the adaptee type
  • Uses the adaptee’s methods to define adaptor methods
  • Stack and Queue implemented via adaptor classes

| | Top of Page | 5. Abstract Data Types: Stacks and Queues - 17 of 22