コード例 #1
0
 virtual public void IAmPrinting(Soft sft)
 {
     if (sft is Game)
     {
         Console.WriteLine("This soft is Game!");
         if (sft is Sapper)
         {
             Console.WriteLine("And this soft is Sapper!");
         }
     }
     else if (sft is TextProcessor)
     {
         Console.WriteLine("This soft is TextProcessor!");
         if (sft is Word)
         {
             Console.WriteLine("And this soft is Word!");
         }
     }
     else if (sft is Bag)
     {
         Console.WriteLine("This soft is Virus!");
         if (sft is CConficer)
         {
             Console.WriteLine("And this soft is CConficer!");
         }
     }
     Console.WriteLine(sft.ToString());
 }
コード例 #2
0
ファイル: Soft.cs プロジェクト: SergeiWal/OOTP
 public override bool Equals(object obj)
 {
     if (obj is Soft && obj != null)
     {
         Soft temp = (Soft)obj;
         if (temp.Name == this.Name && temp.Type == this.Type)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }