我有以下两个类,它们已经继承到
XYZ
中。
国家类
public class country_master : XYZ { private string _id;州类
public string id { get { return _id; } set { _id = value; } } private string _country_code;
public string country_code { get { return _country_code; } set { _country_code = value; } }
private string _country_name;
public string country_name { get { return _country_name; } set { _country_name = value; } } }
public class state_master: XYZ { private string _id;
public string id { get { return _id; } set { _id = value; } } private string _state_code;
public string state_code { get { return _state_code; } set { _state_code= value; } }
private string _state_name;
public string state_name { get { return _state_name= value; } set { _state_name= value; } } }
- 现在,我想在我的
state_master
类中使用country_name
,这可能吗?
state_master
实例都有一个唯一的实例? - doctorlovestate_master
类只能使用XYE
属性,如果你想使用country_name
,可以在state_master
类中作为属性拥有一个country_master
的实例,或者将country_name
移动到XYZ
类中。 - Badro Niaimi