Trusted by 2+ million users, 1000+ happy students everyday
LAB: InheritancePart A – playing with code.1.Save the CatExampleWithInheritance application available on the course page for this week in a trusted location and study the code. Comment the c#code (all the main lines, especially the ones linked to inheritance)2.Save the InterfaceExample application available on the course page for this week in a trusted location and study the code Comment the c# code (all the main lines, especially the ones linked to inheritance)Part B - Change the CatExampleWithInheritance application that you downloadedEXERCISE 1: change the necessary code in the following way:1.In the Cat class add a method called “HasFlees()” which should return a Boolean. This method should be seen only by the base Cat class and its children. The method should return true value. Change the Talk() method so it would say if the cat has flees.2.In the BreedCat class override the method “HasFlees()” and make it return falseEXERCISE 21.You should have noticed that showing cat images is not implemented in a consistent way. Change the code in such way that every cat has a specific image in the following way:In the class Cat have a field “imageString” of type string.Change the code in such way that Fluffy and Jassie are instantiated with the correct images (use a particular cat image for each) .Change the code in such way that all new cats (moggies) will have a particular image of your choiceChange the code in such way that for the breed cats the user can choose a breed from a drop down list and, according to the selected breed, a specified image is displayedHint: you can store the breeds and the images’ names in arrays, generic lists or a table in the database
Found this document preview useful?
You are reading a preview Upload your documents to download or Become a Desklib member to get accesss