Is there any way to delay calling a superclass constructor so 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 the new value for someVar (someVar + 1) to the base class constructor rather than the one passed in to the ChildClass constructor. Is there any way to do this?
Thanks,
Matt
Now if this manipulation is more complicated than incrementing an integer and deserves a separate method, you could call this method inside
basebut this method needs to be static.