Trusted by 2+ million users,
1000+ happy students everyday
Showing pages 1 to 1 of 2 pages
LAB: InheritancePart A – playing with code.1.Save the CatExampleWithInheritance application available on the coursepage 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 thisweek in a trusted location and study the code Comment the c# code (all themain lines, especially the ones linked to inheritance)Part B - Change the CatExampleWithInheritanceapplication 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 aBoolean. This method should be seen only by the base Cat class and itschildren. The method should return true value. Change the Talk() method soit would say if the cat has flees.2.In the BreedCat class override the method “HasFlees()” and make it returnfalseEXERCISE 21.You should have noticed that showing cat images is not implemented in aconsistent way. Change the code in such way that every cat has a specificimage 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 instantiatedwith the correct images (use a particular cat image for each) .Change the code in such way that all new cats (moggies) will have aparticular image of your choiceChange the code in such way that for the breed cats the user canchoose a breed from a drop down list and, according to the selectedbreed, a specified image is displayedHint: you can store the breeds and the images’ names inarrays, generic lists or a table in the database
Desklib Logo
You are reading a preview
Upload your documents to download or

Become a Desklib member to get access