prototypal-inheritanceを使用する一般的な抽象化を使用するjavascriptのファクトリパターンの例を作成しようとしましたが、コンソールログの値は未定義に戻ります。以下 var AthleteFactory = function() {
var athlete, that = this;
this.createAthlete = function(ath
次のパターンは古く、よく知られています。 class A
{
public:
virtual A* clone() const
{
return new A(*this);
}
private:
int x = 666;
};
class B : public A
{
public:
virtual B* clone