私はC#が初めてで、それを試しています。
Form
プロパティを持つスーパークラスがありますFormID
。Form
他の 4 つのサブクラスに継承されます。
Form-> DeployForm -> SystemOut
と
Form_> Colection -> SystemIn
。
FormID
サブクラスからプロパティにアクセスするにはどうすればよいですか? ( DeployForm
、SystemOutColection
、Collectiom
およびSystemIn
?)
// Superclass - Form.
public class Form
{
private int _FormID;
private string _UserName;
private string _ComputerName;
private string _AssetTag;
private string _Department;
private string _Status;
// Below are the associations I linked
// to other classes that don't require attribute FormID.
private FormCategory _differentiateBy;
private CheckList _referencesToChecklist;
private Staff _referencesToStaff;
public Form()
{
_differentiateBy = new FormCategory();
_referencesToChecklist = new CheckList();
_referencesToStaff = new Staff();
}
public int FormID
{
get { return _FormID; }
set { _FormID = value; }
}
}
// Sub Class - DeploymentForm
public class DeploymentForm : Form
{
private DateTime _DeployDate;
private int _DeployBy;
private DateTime _SetupDate;
private int _SetupBy;
public DeploymentForm()
{
}
public DateTime DeployDate
{
get { return _DeployDate; }
set { _DeployDate = value; }
}
public int DeployBy
{
get { return _DeployBy; }
set { _DeployBy = value; }
}
public DateTime SetupDate
{
get { return _SetupDate; }
set { _SetupDate = value; }
}
public int SetupBy
{
get { return _SetupBy; }
set { _SetupBy = value; }
}
}
// etc...