title: print generic for Rcpp class
body: <p>I have some issues writing a <code>R</code> generic printer for a Rcpp class. Think about the Uniform example on page 8 of <a href="http://dirk.eddelbuettel.com/code/rcpp/Rcpp-modules.pdf" rel="nofollow noreferrer">http://dirk.eddelbuettel.com/code/rcpp/Rcpp-modules.pdf</a>. I have tried to define a generic like this:</p>
  
  <pre><code># Create new Uniform object:
  uniform = Uniform$new(1, 2)
  class(uniform)
  
  ## [1] "Rcpp_Uniform"
  ## attr(,"package")
  ## [1] "uniform"
  
  
  # Printer for the object:
  print.Rcpp_Uniform = function (x, ...) { message("Hi, I am an uniform object") }
  </code></pre>
  
  <p>Now, if I type in just <code>uniform</code> I get:</p>
  
  <pre><code>C++ object &lt;000000000d825c80&gt; of class 'Uniform' &lt;000000000287b090&gt;
  </code></pre>
  
  <p>But this is what I try to avoid. Calling the printer directly gives what I like to have:</p>
  
  <pre><code>print(uniform)
  ## Hi, I am an uniform object
  </code></pre>
  
  <p>Is there a way to directly use the custom printer without calling the print function?</p>