using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace oop
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("---------------请输入猫头鹰对象的体重和身高(以回车隔开)------------------");
string w = Console.ReadLine();
string l = Console.ReadLine();
Owl a_Owl = new Owl(w,l);
Console.WriteLine("猫头鹰对象创建成功!!");
Console.WriteLine("猫头鹰的体重是"+a_Owl.weight +"kg");
Console.WriteLine("猫头鹰的身高是"+a_Owl.length +"cm");
Console.WriteLine("猫头鹰的特征是"+ Owl.message);
Console.WriteLine("猫头鹰的生存在" + Owl.habitat);
Console.WriteLine("猫头鹰跟猫很像吗?" + Owl.cat());
Console.WriteLine("---------------程序结束!!------------------");
Console.ReadLine();
}
}
class Mammal //动物全称
{
protected static bool Feeding = true;//有哺乳的特点
}
class Bird:Mammal//鸟类
{
protected static bool catlike = true;//类似猫
protected static bool Fly=true;//可以飞行
}
class Owl : Bird
{
//有自己的特征
internal static string message="猫头鹰吃老鼠";
internal static string habitat = "丛林高树上";
internal string weight; //体重
internal string length; //身高
internal Owl(string w, string l)//构造函数直接赋值
{
this.weight = w;
this.length = l;
}
internal static bool cat()//通过静态方法获取继承的信息
{
return Owl.catlike;
}
}
}