我知道這個問題已被問到,但所有解決方案都沒有解決我的問題。我有繼承一個類的問題,它告訴我缺少哪些是我不知道的任何想法?非常感謝!!不包含採用0參數的約束器
這是我的代碼!
public class Rectangle : Shape (shape is an other file which is work)
{
private Pen pen = new Pen(Color.Blue);
private int size;
protected Rectangle(Point position, int size) : base(position)
{
this.size = size;
}
public Rectangle(int x, int y, int size) : base(new Point(x, y))
{
this.size = size;
}
override public void Draw(Graphics r)
{
r.DrawRectangle(pen, 600, 100 , 50, 50);
}
}
public class Square : Rectangle (here it does not work when inherit)
{
override public void Draw(Graphics r)
{
r.DrawRectangle(pen, 300, 100, 50, 50);
}
}
解決了!許多許多感謝所有! – JEERY