peg - Sheet1 Page 1 #include...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Sheet1 Page 1 #include <iostream> using namespace std typedef int HANDS enum COLOR { Red, Green, Blue, Yellow, White, Black, Brown } class Animal // common base to both horse and bird { public: Animal(int) virtual ~Animal() { cout << "Animal destructor...\n" } virtual int GetAge() const { return itsAge } virtual void SetAge(int age) { itsAge = age } private: int itsAge } Animal::Animal(int age): itsAge(age) { cout << "Animal constructor...\n" } class Horse : virtual public Animal { public: Horse(COLOR color, HANDS height, int age) virtual ~Horse() { cout << "Horse destructor...\n" } virtual void Whinny()const { cout << "Whinny!... " } virtual HANDS GetHeight() const { return itsHeight } virtual COLOR GetColor() const { return itsColor } protected: HANDS itsHeight COLOR itsColor } Horse::Horse(COLOR color, HANDS height, int age): Animal(age), itsColor(color),itsHeight(height) { cout << "Horse constructor...\n" } class Bird : virtual public Animal { public: Bird(COLOR color, bool migrates, int age)...
View Full Document

This note was uploaded on 03/19/2008 for the course CSE 122 taught by Professor Yoxheimer,ericch during the Fall '07 term at Pennsylvania State University, University Park.

Page1 / 2

peg - Sheet1 Page 1 #include...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online