title: convert from pointer to reference in C++
body: <p>I want to create an instance of a class using <code>new</code>, but I want to convert to reference for further usage other than using pointer. Currently I am using this line <code>Foo&amp; rf = *f;</code> to convert explicitly, it seems a bit silly. Any better and more elegant ways to create a reference variable and referring a <code>new</code> created instance?</p>
  
  <p>Here are some code to show what I am doing,</p>
  
  <pre><code>class Foo{
      public:
      Foo(){
  
      }
  
      void printValue() {
          cout &lt;&lt; "This is Foo object " &lt;&lt; endl;
      }
  };
  
  int main() {
      Foo* f = new Foo();
      Foo&amp; rf = *f;
      rf.printValue();
      f -&gt; printValue();
  }
  </code></pre>