Rectangle Class Reference

#include <rectangle.h>

Inheritance diagram for Rectangle:

Shape List of all members.

Public Member Functions

 Rectangle (int l, int w, int x, int y)
 Rectangle (int l, int w, Point c)
virtual std::string getType () const
virtual double getArea () const

Detailed Description

A class that represents a rectangle on a 2D plane. Its only members are its length and width. It inherits all of its functionality from the Shape class.

Author:
Brent Nash


Constructor & Destructor Documentation

Rectangle::Rectangle ( int  l,
int  w,
int  x,
int  y 
)

Overloaded constructor that takes in a length, a width, and an (x,y) coordinate.

Parameters:
l The length of the rectangle (must be greater than 0)
w The width of the rectangle (must be greater than 0)
x The X coordinate of the rectangle's center point in 2D space
y The Y coordinate of the rectangle's center point in 2D space

Rectangle::Rectangle ( int  l,
int  w,
Point  c 
)

Overloaded constructor that takes in a length, a width, and a center Point.

Parameters:
l The length of the rectangle (must be greater than 0)
w The width of the rectangle (must be greater than 0)
c The center point of the rectangle in 2D space


Member Function Documentation

string Rectangle::getType (  )  const [virtual]

Virtual function overridden from Shape. Returns a string indicating what type of shape this object is.

Precondition:
None
Postcondition:
Does not change the object
Returns:
The string "Rectangle"

Implements Shape.

double Rectangle::getArea (  )  const [virtual]

Virtual function overridden from Shape. Returns the area of the rectangle as length*width.

Precondition:
The length and width must be set to valid numbers.
Postcondition:
Does not change the object
Returns:
The area of the rectangle as a floating point number.

Implements Shape.


The documentation for this class was generated from the following files:
Generated on Fri Dec 23 11:21:39 2011 by  doxygen 1.5.2