作业帮 > 数学 > 作业

1.用C#写一个表示盒子的类,要包含算体积的方法 2.另外写一个表示彩色盒子的类继承1题中的盒子类

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:数学作业 时间:2024/06/05 08:04:18
1.用C#写一个表示盒子的类,要包含算体积的方法 2.另外写一个表示彩色盒子的类继承1题中的盒子类
1.用C#写一个表示盒子的类,要包含算体积的方法 2.另外写一个表示彩色盒子的类继承1题中的盒子类
盒子类:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ClassLibrary1
{
public class Case
{
private double length;
public double Length
{
get { return length; }
set { length = value; }
}
private double width;
public double Width
{
get { return width; }
set { width = value; }
}
private double height;
public double Height
{
get { return height; }
set { height = value; }
}
public double TotalArea()
{
return Height * Width * Length;
}
}
}
彩色盒子类继承盒子类:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ClassLibrary1
{
class ChromaticCase:Case
{
}
}