CSC112 Spring 2016 Examples
head 1.1;
access;
symbols;
locks; strict;
comment @ * @;
1.1
date 2016.03.17.15.54.25; author pngwen; state Exp;
branches;
next ;
desc
@@
1.1
log
@Initial revision
@
text
@// This is a class for implementing peg puzzles.
// It displays nifty little pegs. as ( ) and (*) depending on if they are filled
// Revision: $Revision$
// Change Log
// $Log$
#ifndef PEG_H
#define PEG_H
#include <iostream>
#include "widget.h"
typedef std::ostream & (* colorType)(std::ostream &);
class Peg : public Widget
{
public:
//constructors
Peg(int _x, int _y);
Peg();
//display the peg
virtual void display();
//select the peg
virtual void select();
//deselect the peg
virtual void deselect();
//fill the peg hole
virtual void place();
//take the peg from the hole
virtual void take();
//get the status of the peg hole
virtual bool isSelected();
virtual bool isOccupied();
//get and set the color
virtual colorType color();
virtual void color(colorType c);
private:
bool _selected;
bool _occupied;
colorType _color;
};
#endif
@