早教吧作业答案频道 -->数学-->
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
{
}
}
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
{
}
}
看了 1.用C#写一个表示盒子的类...的网友还看了以下:
定冠词用法疑问theday与thedays有什么区别,thedays表示所有的白天,但是the加单 2020-05-13 …
请举出离子方程式否定这些观点1.所有的离子方程式均可表示一类反应2.酸碱中和反应均可表示一类反应3 2020-05-14 …
关于一个英语语法问题the+adj能表示一类人那theadj能表示一类事吗就是比如thefunny 2020-05-17 …
varietyvariousvaryvaried的区别老师你好!请问varietyvariousv 2020-05-17 …
“所有的离子方程式均可以表示一类反应"那个"一类"是哪一类呢?而“所有的离子方程式均可以表示一类反 2020-06-02 …
the表示一类东西问题Doyoubelievein?AaghostBtheghostsCthegh 2020-06-05 …
帮我检查有无做错,下列通式只表示一类物质的是(A)A、CnH2n+2B、CnH2nC、CnH2n- 2020-06-06 …
下列叙述正确的是()A.H++OH-=H2O表示所有强酸和强碱的反应B.所有的离子方程式都可以表示 2020-06-14 …
关于英语中的“冠词”不定冠词a/an可以用于单数可数名词前,表示一类人和事物.如:Atigeris 2020-07-20 …
一个初三英语问题,急~~书上说用不定冠词表示一类事物或人,又说定冠词用在单数可数名词前表示一类人或事 2020-11-07 …