Skip to main content

All Questions

Filter by
Sorted by
Tagged with
7 votes
4 answers
2k views

Can I make my constructors less repetitive?

I'm extending a class with 10 different constructors. The new subclass, SpecialImage, is used like this: SpecialImage specialImage = new SpecialImage(..); // Leverage the Rotate() method of ...
kdbanman's user avatar
  • 1,447
3 votes
2 answers
1k views

Wrapping constructor arguments

Given a base class with around 25 or so subclasses, I have found that adding an argument to the base constructor is painful. protected AbstractController(Service1 s1, Service2 s2, Service3 s3){ ... } ...
Joe's user avatar
  • 133
0 votes
1 answer
3k views

Reuse base() constructor argument in this() constructor

Let's say I have two classes Base and Derived : Base. Derived shall be able to use a DerivedComponent : BaseComponent, just like all other derivates of Base use their own derivate specific component. ...
BooleanAssange's user avatar