public void SubclassesCanRedefineBehaviorThatIsNotVirtual() { ReallyYippyChihuahua suzie = new ReallyYippyChihuahua("Suzie"); //Assert.AreEqual (FILL_ME_IN, suzie.Wag ()); Assert.AreEqual("BUP BUP BUP!!!", suzie.Wag()); }
public void NewingAMethodDoesNotChangeTheBaseBehavior() { //This is vital to understand. In Koan 6, you saw that the Wag //method did what we defined in our class. But what happens //when we do this? Chihuahua bennie = new ReallyYippyChihuahua("Bennie"); Assert.Equal("Happy", bennie.Wag()); //That's right. The behavior of the object is dependent solely //on who you are pretending to be. Unlike when you override a //virtual method. Remember this in your path to enlightenment. }
public void NewingAMethodDoesNotChangeTheBaseBehavior() { // Això és crucial que ho entengueu. A la càpsula 6 heu vist // que el mètode "Wag" feia el que havíem definit a la nostra // classe... Però que passa quan fem això? Chihuahua bennie = new ReallyYippyChihuahua("Bennie"); Assert.AreEqual("Estic content i moc la cua!", bennie.Wag()); // Així és. El comportament de l'objecte és dependent només // de qui preteneu ser (a diferència de quan sobreescrivim un // mètode virtual). Recordeu això en el vostre camí a la il·luminació. }
public void NewingAMethodDoesNotChangeTheBaseBehavior() { //This is vital to understand. In Koan 6, you saw that the Wag //method did what we defined in our class. But what happens //when we do this? Chihuahua bennie = new ReallyYippyChihuahua("Bennie"); Assert.Equal("Happy", bennie.Wag()); // # so I guess that if the WAGWAGWAG wag method had been an override method, // # it would have stuck with the reallyYippyChihuahua even after // # it'd been downcast to a chihuahua. Since it was "born" (instantiated) with it? //That's right. The behavior of the object is dependent solely //on who you are pretending to be. Unlike when you override a //virtual method. Remember this in your path to enlightenment. }
public void SubclassesCanRedefineBehaviorThatIsNotVirtual() { ReallyYippyChihuahua suzie = new ReallyYippyChihuahua("Suzie"); Assert.Equal("WAG WAG WAG!!", suzie.Wag()); }
public void SubclassesCanRedefineBehaviorThatIsNotVirtual() { ReallyYippyChihuahua suzie = new ReallyYippyChihuahua("Suzie"); Assert.AreEqual(FILL_ME_IN, suzie.Wag()); }
public void AboutInheritanceSubclassesCanRedefineBehaviorThatIsNotVirtual() { ReallyYippyChihuahua suzie = new ReallyYippyChihuahua("Suzie"); Assert.AreEqual(FILL_ME_IN, suzie.Wag()); }