Pass-through Constructors

Published on Friday, November 21, 2008

Source

Pass-through Constructors

Pass-through constructors is a term I use to describe parameterized constructors that have none of their own logic and simply pass parameters to the base class. For example:

public class BaseClass

{

private String text;

public BaseClass(String text)

{

this.text = text;

}

}

public class DerivedClass : BaseClass

{

public DerivedClass(String text)

: base(text)

{

}

}

comments powered by Disqus