using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DeskTask
{
public class Desk
{
private int _length;
public int Length
{
get { return _length; }
set { _length = value; }
}
private int _width;
public int Width
{
get { return _width; }
set { _width = value; }
}
private int _height;
public int Height
{
get { return _height; }
set { _height = value; }
}
public int volume//体积
{
get
{
return _length * _width * _height;
}
}
public int area//面积
{
get
{
return _length * _width;
}
}
public Desk():this(1,1,1)
{
}
public Desk(int length, int width):this(length,width,0)
{
}
public Desk(int length, int width, int height)
{
this._length = length;
this._width = width;
this._height = height;
}
public bool Compare(Desk desk)
{
return this.volume > desk.volume;
}
}
class Program
{
static void Main(string[] args)
{
Desk d1 = new Desk(1, 2, 3);
Desk d2 = new Desk(3, 4, 5);
Console.WriteLine(d1.Compare(d2));
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DeskTask
{
public class Desk
{
private int _length;
public int Length
{
get { return _length; }
set { _length = value; }
}
private int _width;
public int Width
{
get { return _width; }
set { _width = value; }
}
private int _height;
public int Height
{
get { return _height; }
set { _height = value; }
}
public int volume//体积
{
get
{
return _length * _width * _height;
}
}
public int area//面积
{
get
{
return _length * _width;
}
}
public Desk():this(1,1,1)
{
}
public Desk(int length, int width):this(length,width,0)
{
}
public Desk(int length, int width, int height)
{
this._length = length;
this._width = width;
this._height = height;
}
public bool Compare(Desk desk)
{
return this.volume > desk.volume;
}
}
class Program
{
static void Main(string[] args)
{
Desk d1 = new Desk(1, 2, 3);
Desk d2 = new Desk(3, 4, 5);
Console.WriteLine(d1.Compare(d2));
}
}
}