RandomSizeShapeFactory Class Reference

#include <shapefactory.h>

Static Public Member Functions

static ShapecreateShape (std::string name)
 

Detailed Description

A factory class to generate Shapes with randomly generated sizes/dimensions.

Author
Brent Nash

Member Function Documentation

◆ createShape()

Shape * RandomSizeShapeFactory::createShape ( std::string  name)
static

Static factory method for creating shapes. Takes in a string representation of a shape and returns a pointer to that particular shape. Only works for shapes that derive from the Shape object. Center points for returned shapes will always be (0,0).

Precondition
None
Postcondition
Does not change the object
Parameters
nameThe name of the shape to generate (e.g. "triangle", "rectangle", or "circle"). Input is case-sensitive.
Returns
A pointer to a Shape object dynamically allocated on the heap if "name" is a valid, recognized shape type or NULL if "name" does not specify the name of a known shape.

The documentation for this class was generated from the following files: