定义父亲类Father(姓lastName,财产property,血型bloodType),儿子Son类(玩游戏PlayGame方法),女儿Daughter类(跳
2016-09-06 10:38
218 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _02C基础加强
{
class Program
{
static void Main(string[] args)
{
//作业:定义父亲类Father(姓lastName,财产property,血型bloodType),儿子Son类(玩游戏PlayGame
// 方法),女儿Daughter类(跳舞Dance发法),调用父类构造函数(:base())给子类字段赋值
}
}
class Father
{
public string LastName { get; set; }
public double Property { get; set; }
public string bloodType { get; set;}
public Father(string lastName, double property, string bloodType)
{
this.LastName = lastName;
this.Property = property;
this.bloodType = bloodType;
}
}
class son : Father
{
public son(string lastName, double property, string bloodType)
: base(lastName, property, bloodType)
{
}
public void PlayGame()
{
Console.WriteLine("儿子可以玩游戏!");
}
}
class Daughter : Father
{
public Daughter(string lasteName, double property, string bloodType)
: base(lasteName, property, bloodType)
{
}
public void Dance()
{
Console.WriteLine("我会跳舞!");
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _02C基础加强
{
class Program
{
static void Main(string[] args)
{
//作业:定义父亲类Father(姓lastName,财产property,血型bloodType),儿子Son类(玩游戏PlayGame
// 方法),女儿Daughter类(跳舞Dance发法),调用父类构造函数(:base())给子类字段赋值
}
}
class Father
{
public string LastName { get; set; }
public double Property { get; set; }
public string bloodType { get; set;}
public Father(string lastName, double property, string bloodType)
{
this.LastName = lastName;
this.Property = property;
this.bloodType = bloodType;
}
}
class son : Father
{
public son(string lastName, double property, string bloodType)
: base(lastName, property, bloodType)
{
}
public void PlayGame()
{
Console.WriteLine("儿子可以玩游戏!");
}
}
class Daughter : Father
{
public Daughter(string lasteName, double property, string bloodType)
: base(lasteName, property, bloodType)
{
}
public void Dance()
{
Console.WriteLine("我会跳舞!");
}
}
}
相关文章推荐
- ASP.NET MVC运行出现Uncaught TypeError: Cannot set property __MVC_FormValidation of null的解决方法
- chapter9: python 类的方法,属性,迭代器(new[old]-type class,[un]bound method,super,protocol,property,iterators)
- Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#<Object>‘的解决方法
- 错误:Property 'XXX' not found on type java.lang.String解决方法
- C#关于通过反射PropertyType判读字符串类型方法
- 解决ajax的Type,Sys未定义问题的方法
- Object.defineProperty()定义对象方法
- Null value was assigned to a property of primitive type原因及解决方法
- property 定义 getter 跟 setter 方法
- 用c++实现PV操作(父亲母亲儿子女儿)
- 父亲跨血型为儿子捐肝手术完成
- sencha touch2---直接用xxtype定义的组件无法使用该实例的方法;必须要用create
- Java基础回顾_Java property_属性 method_方法定义及范围权限控制
- Null value was assigned to a property of primitive type setter of"原因及解决方法
- spring mvc 出现“Failed to convert property value of type”解决方法
- null value was assigned to a property of primitive type setter of原因急解决方法
- Ckeditor: Uncaught TypeError: Cannot read property 'keyCode' of undefined 解决方法
- Null value was assigned to a property of primitive type setter of"原因及解决方法
- javax.el.PropertyNotFoundException: Property 'reviewcontent' not found on type javabean.YbReview解决方法
- 这个错误的解决方法 javax.el.PropertyNotFoundException: Property 'PatchUp' not found on type com.cwkj.qaback.e