Children inherit parent class appear an error

  • Thread starter Thread starter wonglihuang
  • Start date Start date
W

wonglihuang

Guest
class Animal
{
public string name;

public Animal(string name)
{
this.name = name;
}

}

class Dog: Animal //there is an error
{

}



static void Main(string[] args)
{

Dog dog = new Dog();
dog.name = "小狗";

Console.WriteLine(dog.name);

Console.Read();
}


Anyone can help to point to why there is an error.

Continue reading...
 
Back
Top