コード例 #1
0
        public void OpenSafe(Safe safe, Owner owner)
        {
            safe.PickLock(this);
            Jewels safeContents = safe.Open(givenCode);

            ReturnContents(safeContents, owner);
        }
コード例 #2
0
 public virtual void ReturnContents(Jewels safeContents, Owner owner)
 {
     owner.ReceiveContents(safeContents);
 }
コード例 #3
0
 // "override" keyword overrides patrimonial "virtual" ReturnContents method
 public override void ReturnContents(Jewels safeContents, Owner owner)
 {
     stolenJewels = safeContents;
     Console.WriteLine("I'm steal the contents of the safe!" + stolenJewels.Sparkle());
 }
コード例 #4
0
 public void ReceiveContents(Jewels safeContents)
 {
     returnedContents = safeContents;
     Console.WriteLine("Thanks for bringing jewels. " + safeContents.Sparkle());
 }