Performance penalty for working with interfaces in C++?

前端 未结 16 1805
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 11:21

Is there a runtime performance penalty when using interfaces (abstract base classes) in C++?

16条回答
  •  情歌与酒
    2020-12-02 11:42

    The only thing I can think of is that virtual methods are a little bit slower to call than non-virtual methods, because the call has to go through the virtual method table.

    However, this is a bad reason to screw up your design. If you need more performance, use a faster server.

提交回复
热议问题