Is it possible to forbid deriving from a class at compile time?

后端 未结 7 2051
甜味超标
甜味超标 2021-01-02 04:29

I have a value class according to the description in \"C++ Coding Standards\", Item 32. In short, that means it provides value semantics and does not have any virtual method

7条回答
  •  一生所求
    2021-01-02 05:08

    Well, i had a similar problem. This is posted here on SO. The problem was other way around; i.e. only allow those classes to be derived that you permit. Check if it solves your problem.

    This is done at compile-time.

提交回复
热议问题