简体   繁体   中英

c++ derived class with no variables

我有一个派生类,它没有变量,只是将接口改编为另一个类-C ++中的此类是否有特殊名称?

It "adapts" the interface? Assuming that means that it exposes the same behaviour, but with different method calls (or perhaps, slight behavioural changes), then we tend to call that an Adapter . It's a common design pattern.

Related is the Facade pattern, which is an Adapter that simplifies an API. For example, it may provide sensible parameter defaults, or abstract some of the necessary call flow into a unit that can be called by other code.

Rob is correct, what you describe matches the Adapter design pattern.

If it "adapts" more than one class or package behind the scenes, this is also called a Facade .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM