Permalink
Browse files

implicit conversion support: int to MathObject

  • Loading branch information...
1 parent a9ce12f commit 91106c499b7f63a34759cac921c868a8f3afc05a @dharmatech committed Mar 9, 2013
@@ -32,7 +32,7 @@ static void Main(string[] args)
position = new Point(0, 0),
velocity = Point.FromAngle(thA, vA),
acceleration = _g,
- time = new Integer(0)
+ time = 0
};
var objB = new Obj()
@@ -40,7 +40,7 @@ static void Main(string[] args)
position = new Point(0, 0),
velocity = Point.FromAngle(thA, vA),
acceleration = _g,
- time = new Integer(0)
+ time = 0
};
var objB =
View
@@ -8,6 +8,9 @@ namespace Symbolism
public abstract class MathObject
{
//////////////////////////////////////////////////////////////////////
+ public static implicit operator MathObject(int n)
+ { return new Integer(n); }
+ //////////////////////////////////////////////////////////////////////
#region overloads for 'int'
public static MathObject operator +(MathObject a, int b)

0 comments on commit 91106c4

Please sign in to comment.