Sign in to follow this  
riruilo

How do you implement a UTIL class in C++?

Recommended Posts

Hi friends! I'd like to know how do you implement usually UTIL classes or methods (where instancing is not necessary). I guess I should use namespaces, but not sure. Suggestions? Thanks in advance.

Share this post


Link to post
Share on other sites
Well, having it inside a struct or class does give you the ability to have private, public and protected static functions.

But that can usually be dealt with by different header-file/cpp-file based interfaces just as easily (or more so).

Templates, however, cannot be easily duplicated. Traits classes are basically templated namespaces that can differ based on the type and can be reopened-by-specialisation by clients.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this