#include <shape.h>
Inheritance diagram for Shape:
Public Member Functions | |
Shape (int x, int y) | |
Shape (Point c) | |
Point | getCenter () const |
void | setCenter (Point c) |
virtual std::string | getType () const=0 |
virtual double | getArea () const=0 |
Protected Attributes | |
Point | center |
Shape::Shape | ( | int | x, | |
int | y | |||
) |
Overloaded constructor that takes in an (x,y) coordinate.
x | The X coordinate of the shape's center point in 2D space | |
y | The Y coordinate of the shape's center point in 2D space |
Shape::Shape | ( | Point | c | ) |
Overloaded constructor that takes in a center Point.
c | The center point of the shape in 2D space |
Point Shape::getCenter | ( | ) | const |
Accessor for the shape's center point.
void Shape::setCenter | ( | Point | c | ) |
virtual std::string Shape::getType | ( | ) | const [pure virtual] |
virtual double Shape::getArea | ( | ) | const [pure virtual] |
Pure virtual function for Shape subclasses. Subclasses overriding this method should use it to calculate the area of the shape and return the area as a floating point number.
Point Shape::center [protected] |
The center point of the shape as a 2D coordinate