C# class A {} class B:A {} class C:B Main() { A a = new A; B b = new C; A c =b; }A c

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/26 16:23:01
C#classA{}classB:A{}classC:BMain(){Aa=newA;Bb=newC;Ac=b;}AcC#classA{}classB:A{}classC:BMain(){Aa=new

C# class A {} class B:A {} class C:B Main() { A a = new A; B b = new C; A c =b; }A c
C# class A {} class B:A {} class C:B Main() { A a = new A; B b = new C; A c =b; }
A c

C# class A {} class B:A {} class C:B Main() { A a = new A; B b = new C; A c =b; }A c
声明一个A类型的对象c,他引用了B类型对象实例b.
你可以去看一些关于继承、多态的资料,会对你很有帮助.