C++ Style: Prefixing virtual keyword to overridden methods

后端 未结 6 626
名媛妹妹
名媛妹妹 2020-12-09 03:15

I\'ve been having a discussion with my coworkers as to whether to prefix overridden methods with the virtual keyword, or only at the originating base class.

I tend t

6条回答
  •  爱一瞬间的悲伤
    2020-12-09 03:21

    I can think of one disadvantage: When a class member function is not overridden and you declare it virtual, you add an uneccessary entry in the virtual table for that class definition.

提交回复
热议问题