How to implement php constructor that can accept different n开发者_JAVA技巧umber of parameters? Like
is it possible to have more开发者_运维百科 than one constructors for a class in javascript? i.e. one with zero parameters, one with one, one with two, etc...
Suppose I have a Java class with multiple constructors: class Base { Base(int arg1) {...}; Base(String arg2) {...};
Given a finite number of items which differ in kind, is it better to represent them with stacked enums and enum construct开发者_StackOverflow中文版ors, or to subclass them? Or is there a better approa
I want a few constructors defined in a PHP class. However, my code for the constructors is currently very similar. I would rather not repeat code if possible. Is there a way to call other constructors