Kısıt - Türetilmiş Sınıf varsayılan Oluşturucu olmalıdır

0 Cevap php

I want to Constraint that the Derived Class must have a Default Constructor. I am currently thinking it in a perverted way

template <typename Derived>
class Base{
  public:
    Base(){

    }
    virtual ~Base(){
      new Derived;
    }
};

Zihin argümanlar yok olan) yöntemi (oluşturduğunuz bir saf sanal tutmak için başka bir fikir gelir.

But is there any other way ? Other than these two. I am thinking it in C++ way. But Is there any way to do this in PHP (I expect negetive answer LOL)

0 Cevap