C++-Class-Util & Helper

佚名 / 2023-05-23 / 原文

C++-Class-Util & Helper

https://zhuanlan.zhihu.com/p/352749160

A Utility class is understood to only have static methods and be stateless. You would not create an instance of such a class.
A Helper can be a utility class or it can be stateful or require an instance be created.

翻译一下。

Util类,一般是无状态的,只包含静态方法。使用时无需创建类的实例。
Helper类,可以有状态(类的成员变量),一般需要创建实例才能使用。