Boost logo

Boost :

From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2007-10-09 17:38:00

Steven wrote:
>Suppose that I want to write
>template<class Rectangle, class T>
>void move_up(Rectangle&, T offset);
>to modify a rectangle in place.
>if I need to copy the rectangle this isn't
>going to work.

You don't need to copy the rectangle. It does work. Inheritance and
composition are just syntactical ways that I can view your data as a
rectangle of my type in place. The whole point of my design pattern is
that you don't need to copy the rectangle. mimic doesn't copy, it
returns a reference to your object of the subclass type with a (safe)


Boost list run by bdawes at, gregod at, cpdaniel at, john at