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;
}
};
Another idea comes to mind is to keep a pure virtual create() method with no arguments.
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)
Yes, there’s a way in PHP LOL:
Basically, you just have to mark the constructor final.