So I was looking at the example provided here:
And I decided to experiment a little with the Sheep class doing the following:
Other than allowing for your CLASS METHOD to be used by multiple INTERFACES in the same class. What are any other reasons we should consider using a CLASS METHOD versus just laying the code straight into an INTERFACE METHOD?
-Ken
And I decided to experiment a little with the Sheep class doing the following:
Code:
CLASS Sheep CLASS METHOD SheepGroom() AS STRING METHOD="You Shear The Sheep." END METHOD INTERFACE ISheep : INHERIT Animal, IAnimal 'Note that in this 'Sheep' class we OVERRIDE PROPERTY SET ItsName(BYVAL strName AS STRING) 'didn't provide a unique and specific MyBase.ItsName="The Sheep" 'Override for the base class MakeSound() END PROPERTY 'Method, so if MakeSound() is called on 'a Sheep object the base class method OVERRIDE METHOD Eat() AS STRING 'will be called (see output below). METHOD=MyBase.ItsName & " Ate Some Grass." END METHOD OVERRIDE METHOD MakeSound() AS STRING 'term 'this'. Its usually optional METHOD=MYBASE.ItsName & " Makes a baabaa Sound." 'to use it but to make the code END METHOD END INTERFACE INTERFACE ICare : INHERIT IUNKNOWN METHOD Groom() AS STRING METHOD=Me.SheepGroom() END METHOD METHOD Deworm() AS STRING METHOD="You Give The Sheep A Dose Of Dewormer." END METHOD END INTERFACE END CLASS
-Ken
Comment