R
russ.haley
My question is mostly syntactical but I can't seem to find an answer
for it:
I would like to create a constructor on a derived class that creates
one of the parameters for the base class and then passes it to the base
class constructor as follows:
public abstract class BaseClass
{
private int Param1;
private byte[] Param2;
public BaseClass(int intParam1, byte[] abytParam2)
{
Param1 = intParam1;
Param2 = abytParam2;
}
}
public class MyDerivedClass : BaseClass
{
public MyDerivedClass(int intParam1, byte[] abytParam2):
base(intParam1, abytParam2)
{}
//***** This is where I'm stuck
public MyDerivedClass(int intParam1)
{
//CREATE abytParam2 in this contructor
// and pass it to the base constructor
// for BaseClass(int, byte[])
}
}
This should be easy. ANY suggestions would be great.
Cheers,
Russ
for it:
I would like to create a constructor on a derived class that creates
one of the parameters for the base class and then passes it to the base
class constructor as follows:
public abstract class BaseClass
{
private int Param1;
private byte[] Param2;
public BaseClass(int intParam1, byte[] abytParam2)
{
Param1 = intParam1;
Param2 = abytParam2;
}
}
public class MyDerivedClass : BaseClass
{
public MyDerivedClass(int intParam1, byte[] abytParam2):
base(intParam1, abytParam2)
{}
//***** This is where I'm stuck
public MyDerivedClass(int intParam1)
{
//CREATE abytParam2 in this contructor
// and pass it to the base constructor
// for BaseClass(int, byte[])
}
}
This should be easy. ANY suggestions would be great.
Cheers,
Russ