M
mblatch
This is probably a C#-101 type question, but I've struck out on finding
an answer. I am setting up a class with a few overloaded constructors.
Inside those constructors, I would like to call the "default"
zero-argument constructor. The compiler gives me an error
"PC_StreamBuffer is a type but is used like a variable". I've tried
adding "this." in front of references to PC_StreamBuffer(), but that
gives another compiler error. A simplified version of the class is as
follows:
class PC_StreamBuffer
{
private byte[] data;
public PC_StreamBuffer()
{
length=0;
data=new byte[1000];
}
public PC_StreamBuffer(byte[] vals, int valsLength)
{
PC_StreamBuffer();
this.Set(vals, valsLength);
}
public PC_StreamBuffer(byte[] vals)
{
PC_StreamBuffer();
this.Set(vals);
}
<remainder of class methods removed>
}
Thanks,
Mike
an answer. I am setting up a class with a few overloaded constructors.
Inside those constructors, I would like to call the "default"
zero-argument constructor. The compiler gives me an error
"PC_StreamBuffer is a type but is used like a variable". I've tried
adding "this." in front of references to PC_StreamBuffer(), but that
gives another compiler error. A simplified version of the class is as
follows:
class PC_StreamBuffer
{
private byte[] data;
public PC_StreamBuffer()
{
length=0;
data=new byte[1000];
}
public PC_StreamBuffer(byte[] vals, int valsLength)
{
PC_StreamBuffer();
this.Set(vals, valsLength);
}
public PC_StreamBuffer(byte[] vals)
{
PC_StreamBuffer();
this.Set(vals);
}
<remainder of class methods removed>
}
Thanks,
Mike