我正在使用一个界面引用变量来访问接口上的属性
但除此之外,执行接口的类别也有其自身的属性。
我无法通过此界面引用访问类属性 。
以下是我的问题:
1) 为什么会这样?
2) 这个问题的解决方案是什么?我是否可以通过机器进入空调级的冷却电源变量?TYPE CAST是否有效?
interface IMachines
{
#region properties
int machineID { get; set; 时 时
static int totalID { get; set; 时 时
string name { get; set; 时 时
string make { get; set; 时 时
int weight { get; set; 时 时
int cost { get; set; 时 时
int warranty { get; set; 时 时
DateTime creationDate { get; set; 时 时
#endregion
int generateWarrantyExpiry();
int searchMachine();
时 时
public class AC:IMachines
{
#region ACMembers
protected int _machineID;
protected string _name;
protected int _weight;
protected string _make;
protected DateTime _creationDate;
protected int _warranty;
protected int _cost;
public int _coolentPower;
public int CoolentPower
{
get { return _coolentPower; 时 时
set { _coolentPower = value; 时 时
时 时
#endregion
#region IMachines Members
public int machineID
{
get { return _machineID; 时 时
set { _machineID = value; 时 时
时 时
public string name
{
get { return _name; 时 时
set { _name = value; 时 时
时 时
public string make
{
get { return _make; 时 时
set { _make = value; 时 时
时 时
public int weight
{
get { return _weight; 时 时
set { _weight = value; 时 时
时 时
public int cost
{
get { return _cost; 时 时
set { _cost = value; 时 时
时 时
public int warranty
{
get { return _warranty; 时 时
set { _warranty = value; 时 时
时 时
public DateTime creationDate
{
get { return _creationDate; 时 时
set { _creationDate = value; 时 时
时 时
public int searchMachine()
{
//Search machine logic to be implemented
return 2
时 时
public void GenerateWarranty()
{
//generate warranty logic to be implemented
时 时
#endregion
时 时
时 时