c#中父子类之间?
c#中父子类之间,构造函数的调用规则和调用方法
输入代码 public class A { int i,j; public A(int a, int b) { i = a; j = b; } public override string ToString() { return "i="+i+",j="+j+""; } } public class B:A { int d, c; public B(int x, int y, int z, int e):base(x,y) { d = z; c = e; } public new string ToString() { return "d=" + d + ",c=" + c + ""; } } 调用B b = new B(1, 2, 3, 4); Console。
WriteLine(b。ToString()); Console。ReadLine(); A a = b; Console。WriteLine(a。ToString()); Console。
ReadLine();。
public class A { int i,j; public A(int a, int b) { i = a; j = b; } public override string ToString() { return "i="+i+",j="+j+""; } } public class B:A { int d, c; public B(int x, int y, int z, int e):base(x,y) { d = z; c = e; } public new string ToString() { return "d=" + d + ",c=" + c + ""; } } 调用B b = new B(1, 2, 3, 4); Console。
WriteLine(b。ToString()); Console。ReadLine(); A a = b; Console。WriteLine(a。ToString()); Console。
ReadLine();。
public class A { int i,j; public A(int a, int b) { i = a; j = b; } public override string ToString() { return “i=“+i+“,j=“+j+““; } } public class B:A { int d, c; public B(int x, int y, int z, int e):base(x,y) { d = z; c = e; } public new string ToString() { return “d=“ + d + “,c=“ + c + ““; } } 调用B b = new B(1, 2, 3, 4); Console。
WriteLine(b。ToString()); Console。ReadLine(); A a = b; Console。WriteLine(a。ToString()); Console。
ReadLine();。
答:几种让父子更亲密的方法: 1、打造“父子空间” 人们往往认为女人比男人更懂得如何照顾婴儿,其实,男人在照顾婴儿上也有自己的一套,婴儿会喜欢这种不同的感觉。 ...详情>>
答:详情>>