namespace OperatorOvlApplication {
public double getVolume() {
return length * breadth * height;
public void setLength( double len ) {
public void setBreadth( double bre ) {
public void setHeight( double hei ) {
public static Box operator+ (Box b, Box c) {
box.length = b.length + c.length;
box.breadth = b.breadth + c.breadth;
box.height = b.height + c.height;
public static bool operator == (Box lhs, Box rhs) {
if (lhs.length == rhs.length && lhs.height == rhs.height
&& lhs.breadth == rhs.breadth) {
public static bool operator !=(Box lhs, Box rhs) {
if (lhs.length != rhs.length || lhs.height != rhs.height ||
lhs.breadth != rhs.breadth) {
public static bool operator <(Box lhs, Box rhs) {
if (lhs.length < rhs.length && lhs.height < rhs.height
&& lhs.breadth < rhs.breadth) {
public static bool operator >(Box lhs, Box rhs) {
if (lhs.length > rhs.length && lhs.height >
rhs.height && lhs.breadth > rhs.breadth) {
public static bool operator <=(Box lhs, Box rhs) {
if (lhs.length <= rhs.length && lhs.height
<= rhs.height && lhs.breadth <= rhs.breadth) {
public static bool operator >=(Box lhs, Box rhs) {
if (lhs.length >= rhs.length && lhs.height
>= rhs.height && lhs.breadth >= rhs.breadth) {
public override string ToString() {
return String.Format("({0}, {1}, {2})", length, breadth, height);
public static void Main(string[] args) {
Console.WriteLine("Box 1: {0}", Box1.ToString());
Console.WriteLine("Box 2: {0}", Box2.ToString());
volume = Box1.getVolume();
Console.WriteLine("Volume of Box1 : {0}", volume);
volume = Box2.getVolume();
Console.WriteLine("Volume of Box2 : {0}", volume);
Console.WriteLine("Box 3: {0}", Box3.ToString());
volume = Box3.getVolume();
Console.WriteLine("Volume of Box3 : {0}", volume);
Console.WriteLine("Box1 is greater than Box2");
Console.WriteLine("Box1 is not greater than Box2");
Console.WriteLine("Box1 is less than Box2");
Console.WriteLine("Box1 is not less than Box2");
Console.WriteLine("Box1 is greater or equal to Box2");
Console.WriteLine("Box1 is not greater or equal to Box2");
Console.WriteLine("Box1 is less or equal to Box2");
Console.WriteLine("Box1 is not less or equal to Box2");
Console.WriteLine("Box1 is not equal to Box2");
Console.WriteLine("Box1 is not greater or equal to Box2");
Console.WriteLine("Box3 is equal to Box4");
Console.WriteLine("Box3 is not equal to Box4");