M
mp
I can't get the syntax right
I'm trying to make a base class MoldPart and sub classes, MoldSide, MoldEnd,
MoldBase etc
in the base class i have
public abstract class MoldPart
{
private string myId;
private double myWidth;
private double myLength;
private double myThickness;
public MoldPart(string sID, double dWidth, double dLength, double
dThickness)
{
Id = sID;
Width = dWidth;
Length = dLength;
Thickness = dThickness;
}
and implementations for width, length etc
in the sub class i can't get the syntax right to derive from base
what goes after the colon?
when I put "base" there I get an error
Error 1 An object reference is required for the non-static field, method, or
property 'MoldPart.Id.get' \
when i put "new base" there I get an error
Error 1 Keyword 'this' or 'base' expected
when I put "this" there i get an error:
Error 2 An object reference is required for the non-static field, method, or
property 'MoldPart.Width.get'
public class Side : MoldPart
{
private string myId;
private double myWidth;
private double myLength;
private double myThickness;
public Side(string sId, double dWidth, double dLength, double dThickness) :
this (Id, Width, Length, Thickness)
{
myId = sId;
myWidth = dWidth;
myLength = dLength;
myThickness = dThickness;
}
I'm trying to make a base class MoldPart and sub classes, MoldSide, MoldEnd,
MoldBase etc
in the base class i have
public abstract class MoldPart
{
private string myId;
private double myWidth;
private double myLength;
private double myThickness;
public MoldPart(string sID, double dWidth, double dLength, double
dThickness)
{
Id = sID;
Width = dWidth;
Length = dLength;
Thickness = dThickness;
}
and implementations for width, length etc
in the sub class i can't get the syntax right to derive from base
what goes after the colon?
when I put "base" there I get an error
Error 1 An object reference is required for the non-static field, method, or
property 'MoldPart.Id.get' \
when i put "new base" there I get an error
Error 1 Keyword 'this' or 'base' expected
when I put "this" there i get an error:
Error 2 An object reference is required for the non-static field, method, or
property 'MoldPart.Width.get'
public class Side : MoldPart
{
private string myId;
private double myWidth;
private double myLength;
private double myThickness;
public Side(string sId, double dWidth, double dLength, double dThickness) :
this (Id, Width, Length, Thickness)
{
myId = sId;
myWidth = dWidth;
myLength = dLength;
myThickness = dThickness;
}