using System; using System.Collections.Generic; using System.Reflection.Emit; using System.Text; using Sunweaver.VM; namespace Sunweaver { /// /// All DNA commands inherit from this class. It handles a basic interface as well as a default /// ToString method. /// abstract public class BasePair { abstract public void Implementation(VirtualMachine VM); abstract internal void Compile(ILGenerator il, Locals locals); public override string ToString() { return this.GetType().Name; } public override bool Equals(object obj) { if(obj.GetType() == GetType()) { return Equals((BasePair)obj); } else { return false; } } public bool Equals(BasePair other) { // using string to compare is safest, I think return this.ToString().Equals(other.ToString()); } public override int GetHashCode() { return base.GetHashCode(); } } }