How to automatically register a class on creation

前端 未结 6 1628
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 03:50

I was wondering whether a design pattern or idiom exists to automatically register a class type. Or simpler, can I force a method to get called on a class by simply extendin

6条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 04:09

    Usually I do this with a macro.

    Unit test frameworks often employ the technique for registering the tests, e.g. GoogleTest

提交回复
热议问题