.

Tuesday, January 7, 2014

It 218 Wk. 8 Derived Classes And Base Classes

The side by side(p) is University of Phoenix IT/218 week 8 bump file: Derived Classes and Base Classes. The following contains the code from the text decl ar as well as corrected code for practise 2 on p. 597 of the text book. CheckPoint: Derived Classes and Base Classes: Due Friday in appellation Section Complete Exercise 2 on p. 597. Answer the following question in one paragraph. How are derived syndicatees and metrical foot classes link in this exercise? Derived Classes and Base Classes The following code is from exercise 2 on page 597 chapter 9 of the textbook. Suppose you accept a class CBird, as follows, that you extremity to use as a base class for ancestry a pecking order of bird classes: class CBird { saved: int wingspread; int eggSize; int airSpeed; int altitude; humanity: practical(prenominal) void fly() { altitude = light speed; } }; Is it commonsensical to take a leak a CHawk by deriving from CBird? How about a COstrich? con done your answers. Derive an avian hierarchy that can cope with twain(prenominal) of these birds. It is reasonable to derive the class CHawk from CBird, but I do not think that it is reasonable to derive COStrich from CBird because the ostrich is a flightless bird.
Ordercustompaper.com is a professional essay writing service at which you can buy essays on any topics and disciplines! All custom essays are written by professional writers!
A kick downstairs hierarchy of classes would represent both birds of flight and flightless birds such(prenominal) as the ostrich and the penguin. In the following code, Chawk can be derived from CFlyingBird and COStrich is dervied from CFlightlessBirdwhile both still handle the same common base class of CBird. class CBird { defend: int wingSpa n; int eggSize; }; class CFlightless! Bird: humanity CBird { }; class CFlyingBird: public CBird { protected: int airSpeed; int altitude; public: virtual void fly( {altitude = 100; };If you want to get a full essay, order it on our website: OrderCustomPaper.com

If you want to get a full essay, visit our page: write my paper

No comments:

Post a Comment