Advantages of an empty class in C++

后端 未结 9 1628
夕颜
夕颜 2020-12-08 20:51

What could be the possible advantages/uses of having an empty class?

P.S: This question might sound trivial to some of you but it is just for learning purpose and h

9条回答
  •  不思量自难忘°
    2020-12-08 21:33

    You can use it like a placeholder for checking purpose or as enabler to special functionality. For example in Java exist the "empty" interface Serializable used to specify if a class is serializable.

提交回复
热议问题