Is there a way to defer a call to the superclass constructor so that you can manipulate the variables first?
Eg.
public class ParentClass
{
private int someVar;
public ParentClass(int someVar)
{
this.someVar = someVar;
}
}
public class ChildClass : ParentClass
{
public ChildClass(int someVar) : base(someVar)
{
someVar = someVar + 1
}
}
I want to be able to send a new value for someVar(someVar + 1) to the constructor of the base class, and not the one that was passed to the constructor ChildClass. Is there any way to do this?
Thanks
Matt
source
share