Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. public abstract class AType : IComparable<AType>, IEquatable<AType>
  2.     {
  3.         public AType() { DefaultInit(); }
  4.         public AType(string str) { StringInit(str); }
  5.    
  6.  
  7.         public int CompareTo([AllowNull] AType other)
  8.         {
  9.             return CompareToImpl(other);
  10.         }
  11.  
  12.         public bool Equals([AllowNull] AType other)
  13.         {
  14.             return EqualsImpl(other);
  15.         }
  16.  
  17.         public void SetFromString(string str)
  18.         {
  19.             StringInit(str);
  20.         }
  21.  
  22.         public override string ToString()
  23.         {
  24.             return ToStringImpl();
  25.         }
  26.         protected abstract int CompareToImpl([AllowNull] AType other);
  27.         protected abstract bool EqualsImpl(AType other);
  28.         protected abstract void DefaultInit();
  29.         protected abstract void StringInit(string str);
  30.         protected abstract string ToStringImpl();
  31.  
  32.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement