using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ch11Ex01
{
public class Chicken : Animal
{
public void LayEgg()
{
详情回复
发表于 2014-8-12 23:14
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ch11Ex01
{
public class Chicken : Animal
{
public void LayEgg()
{
Console.WriteLine("{0} has laid an egg.", name);
}
//继承来的方法
//public void Feed()
//{
// Console.WriteLine("{0} has been fed.", name);
//}
//public string Name
//{
// get
// {
// return name;
// }
// set
// {
// name = value;
// }
//}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ch11Ex01
{
public abstract class Animal//定义一个抽象类
{
protected string name;//
详情回复
发表于 2014-8-12 23:14