CSC112 Spring 2016 Examples
// This is a class for implementing peg puzzles.1// It displays nifty little pegs. as ( ) and (*) depending on if they are filled2// Revision: $Revision: 1.1 $3// Change Log4// $Log: peg.h,v $5// Revision 1.1 2016/03/17 15:54:25 pngwen6// Initial revision7//89#ifndef PEG_H10#define PEG_H11#include <iostream>12#include "widget.h"1314typedef std::ostream & (* colorType)(std::ostream &);151617class Peg : public Widget18{19public:20//constructors21Peg(int _x, int _y);22Peg();2324//display the peg25virtual void display();2627//select the peg28virtual void select();2930//deselect the peg31virtual void deselect();3233//fill the peg hole34virtual void place();3536//take the peg from the hole37virtual void take();3839//get the status of the peg hole40virtual bool isSelected();41virtual bool isOccupied();4243//get and set the color44virtual colorType color();45virtual void color(colorType c);4647private:48bool _selected;49bool _occupied;50colorType _color;51};525354#endif555657