我没有在这段代码中得到基类成员。请建议。我是这里的菜鸟
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CaseStudy1
{
class base1
{
protected string name = "";
public base1() {}
public base1(string dad)
{
this.name = dad;
}
}
class child1 : base1
{
private string name = "";
public child1()
{
this.name = base.name;
}
public void show()
{
base1 b1 = new base1("Daddy");
Console.WriteLine("base name"+base.name);
Console.WriteLine("child's name" + name);
}
public static void Main(string[] args)
{
child1 c1 = new child1();
c1.show();
Console.ReadLine();
}
}