繼承的屬性我已經在單獨的項目/組件基類等不能訪問對象
public class Shape
{
public int myTestproperty { get; set; }
}
然後創建另一個項目包括在創建的項目形狀類成分/ DLL和創建另一個類和繼承與形狀該類類像
public class Rectangle : Shape
{
public int getArea()
{
return (width * height);
}
}
,然後當我在同一個項目中創建Rectangle類的對象像
Rectangle Rect = new Rectangle();
我不能訪問諸如
Rect.myTestproperty =1;
我的基類屬性可以有一個人告訴我,我怎麼可以訪問我的基類屬性?
你確定'Rectangle:Shape'中的'Shape'與'public class Shape'中的'Shape'相同嗎?在「矩形:形狀」中將光標移動到「形狀」上並按下「F12」。 – dotctor
您是否嘗試過構建解決方案並檢查問題是否得到解決? – dotctor
是的,按F12按基類定位,但記得我的基類是在其他項目中 – Agahii