An alternative to the Handle class approach is to make Person a special kind of abstract base class called a Protocol class. By
definition, a Protocol class has no implementation; its raison d'être is to specify an interface for derived classes (see Item 36). As a result, it typically has no data members, no constructors, a virtual destructor (see Item 14), and a set of pure virtual functions that specify the interface. A Protocol class for Person might look like this: class Person { public: virtual ~Person(); virtual string name() const = 0; virtual string birthDate() const = 0; virtual string address() const = 0; virtual string nationality() const = 0;};
简而言之,就是一种特殊的抽象类,特殊在哪里?抽象类可以有实现的部分,但是协议类完全没有实现,相当于java接口。(说抽象类相当于接口有点牵强,但说协议类相当于接口勉强可以接受,呵呵。)