fin_proj_part_K - CSci 1113, Spring 2010 Final Project:...

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

View Full Document Right Arrow Icon
Part K 1 CSci 1113, Spring 2010 Final Project: Forest Fire Simulation Part K - Inheritance Create a directory named final_project_K and copy all your Tree class and Forest class files to it. Do all your work for part K using this new directory. 1. Inheritance Using the Tree Class a) Begin by creating a new Tree class member function named showSymbol() that displays a single character representing a Tree object. For example, use '!' as the symbol for a Tree object. You can use the "escape codes" from part E to add color to the symbol. The function should have a reference to an ostream object as its parameter. Next, using the Tree class as the base class, create derived class Oak. Class Oak will not have any new data members. It will have as public member functions a default constructor, a constructor with parameters, and showSymbol() which displays the character '@' to represent an oak tree. Put the declaration part of the Oak class in file oak.h and the implementation part in file oak.cpp . After testing the Oak class, derive a similar Pine class. The Pine class showSymbol() member function should display the character '^' to represent a pine tree. b) With the Tree base class and derived classes Oak and Pine, you can explore the
Background image of page 1

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

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

This note was uploaded on 10/28/2010 for the course CSCI 1113 taught by Professor Staff during the Spring '08 term at Minnesota.

Page1 / 3

fin_proj_part_K - CSci 1113, Spring 2010 Final Project:...

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