title: How Utility functions can be shared across various classes?
body: <p>I had a class Display with 2 utility functions getDate and getTime like below.</p>
  
  <pre><code>class Display
  {
  public:
    void getDate(char *pDate); //Utility functions for converting to custom format
    void getTime(char *pTime);
  };
  </code></pre>
  
  <p>Later, In other class called Retriever also, i needed the same Utility functions getDate and getTime. I do not want to make <code>getDate</code> and <code>getTime</code> functions global(Or C like functions), to avoid accidental usage of these functions(which are specific to these 2 classes). Even wrapping them in namespace won't prevent accidental usage.</p>
  
  <p>Display and Retriever are dissimilar classes. Can't use inheritance between them. Can't use Composition and aggregation as the lifetime of the objects of those classes will be different. They do not exist together(at same time).</p>
  
  <p>Is there any good way of moving Utility functions out of Display and use them in both classes Display and Retriever ? 
  Is it good to put getDate and getTime in seperate class called Utilities and use object of it in classes Display and Retriever ?</p>