lab_inheritance
Insidious Inheritance
|
A subclass of Shape that represents a Circle in 2D space. More...
#include <circle.h>
Public Member Functions | |
Circle (const Vector2 ¢er, const cs225::HSLAPixel &color, int radius) | |
Constructs a new Circle with the given center, color, and radius. More... | |
int | area () const |
Computes and returns the area of the Circle in pixels. More... | |
int | perimeter () const |
Computes and returns the perimeter of the Circle in pixels. More... | |
bool | contains (const Vector2 &p) const |
Checks to see if the given point is inside the Circle. More... | |
void | draw (cs225::PNG *canvas) const |
Draws the Circle to the canvas. More... | |
int | radius () const |
Gets the radius of the Circle in pixels. More... | |
void | set_radius (int radius) |
Sets the radius of the Circle in pixels. More... | |
Public Member Functions inherited from Shape | |
Shape () | |
Constructs a new Shape with a default color and center. More... | |
Shape (const Vector2 ¢er, const cs225::HSLAPixel &color) | |
Constructs a new Shape with the given center and color. More... | |
~Shape () | |
int | area () const |
Computes and returns the area of the Shape in pixels. More... | |
int | perimeter () const |
Computes and returns the perimeter of the Shape in pixels. More... | |
bool | contains (const Vector2 &p) const |
Checks to see if the Vector2 p is contained inside of the Shape. More... | |
Vector2 | center () const |
Gets the center Vector2 of the Shape. More... | |
virtual void | set_center (const Vector2 ¢er) |
Sets the center Vector2 of the Shape. More... | |
cs225::HSLAPixel | color () const |
Gets the color of the Shape. More... | |
void | draw (cs225::PNG *canvas) const |
This method will draw the object onto the canvas. More... | |
Public Member Functions inherited from Drawable | |
~Drawable () | |
Private Member Functions | |
void | drawPoints (cs225::PNG *canvas, int x, int y) const |
Private Attributes | |
int | radius_ |
Additional Inherited Members | |
Protected Attributes inherited from Shape | |
Vector2 | center_ |
Circle::Circle | ( | const Vector2 & | center, |
const cs225::HSLAPixel & | color, | ||
int | radius | ||
) |
int Circle::area | ( | ) | const |
bool Circle::contains | ( | const Vector2 & | p | ) | const |
|
virtual |
|
private |
int Circle::perimeter | ( | ) | const |
int Circle::radius | ( | ) | const |
void Circle::set_radius | ( | int | radius | ) |
|
private |