
On Thu, Apr 29, 2010 at 11:34 AM, Joseph Gauterin
Making it private don't see how it could work C++'s private does not prevent ovrerriding (unlike some other languages)
Thank you. I admit this were unknown to me. I though that derived classes could override public/protected function only.
Why should the virtual function be private? The desired interface is a function that takes any type the implements the random double generator 'concept'. Template functions cannot be virtual. That leads to a private virtual function (which can be overridden in derived classes, but not called) and a public template function that calls the private virtual function after translating the argument into a useable form.
More generally, Herb Sutter's recommendation to "prefer to make base class virtual functions private" (http://www.gotw.ca/publications/mill18.htm) is sound advice.
Got it! Thank you very much for pointing this article out. Cheers, -- Marco