「More C++ Idioms/仮想コンストラクタ(Virtual Constructor)」の版間の差分

削除された内容 追加された内容
6 行
 
=== Motivation ===
Uses of calling member functions in a class hierarchy polymorphically are well known in the object-oriented programming community. It is a way of implementing the "is-a" (or more practically the, "behaves-as-a") relationship. Sometimes it is useful to call life-cycle management (creation, copy, and destruction) functions of a class hierarchy polymorphically.
 
C++ natively supports polymorphic destruction of objects using a virtual destructor. An equivalent support for cration and coping of objects is missing. In C++, creation of object(s) always requires its type to be known at compile-time. The Virtual Constructor idiom allows polymorphic creation of and coping of objects in C++.