Is it possible to have a constructor in a class, that you can ignore certain arguments/parameters?
For example, I have this constructor
Car(color, make, model, wheels, type, doors)
Could I call this constructor and not include the type parameter?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.Sign up to join this community
Builder Pattern is exact solution to this problem. Especially if the combination of optional and required parameters get big, which would require tons of different constructors.