Afficher un message
Vieux 09/06/2008, 14h15   #5
James Kanze
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to copy a vector if pointers to base class

On Jun 9, 1:02 pm, Frank Birbacher <bloodymir.c...@gmx.net> wrote:
> Daniel T. schrieb:


> > Or:


> > transform(rhs.repertory_.begin(), rhs.repertory_.end(),
> > back_inserter(repertory_), mem_fun(&Base::clone));


> The mem_fun will not do virtual dispatch here!


The mem_fun has exactly the same semantics of calling the
function directly; if the function is declared virtual in Base,
and you call it correctly with a pointer to the base, then it
will use virtual dispatch.

--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
  Réponse avec citation
 
Page generated in 0,04880 seconds with 9 queries