我正在尝试以下但给我编译时错误
class Program
{
static void Main(string[] args)
{
shape.innershape s = new rectangle(); // Error Here
}
}
class shape
{
public int nshape = 0;
public shape()
{
nshape = 1;
innershape n = new innershape();
}
public void MakeOuterShape()
{
}
public class innershape
{
public int nInnerShape = 0;
public innershape()
{
nInnerShape = 1;
}
public void makeInnerShape()
{
}
}
}
class rectangle :shape
{
// Code goes here.
}
我正在继承Shape
包含类定义的innershape
类。但是当我尝试制作Rectangle
类的实例时,会innershape
显示编译时错误。为什么 ??以及如何使它成为可能?