Commit c02b31ae authored by Robert Bradshaw's avatar Robert Bradshaw

Fix C++ example namespace

parent 5d354540
...@@ -75,43 +75,38 @@ and the implementation in the file called :file:`Rectangle.cpp`: ...@@ -75,43 +75,38 @@ and the implementation in the file called :file:`Rectangle.cpp`:
#include "Rectangle.h" #include "Rectangle.h"
using namespace shapes; namespace shapes {
Rectangle::Rectangle(int X0, int Y0, int X1, int Y1) Rectangle::Rectangle(int X0, int Y0, int X1, int Y1) {
{
x0 = X0; x0 = X0;
y0 = Y0; y0 = Y0;
x1 = X1; x1 = X1;
y1 = Y1; y1 = Y1;
} }
Rectangle::~Rectangle() Rectangle::~Rectangle() { }
{
}
int Rectangle::getLength() int Rectangle::getLength() {
{
return (x1 - x0); return (x1 - x0);
} }
int Rectangle::getHeight() int Rectangle::getHeight() {
{
return (y1 - y0); return (y1 - y0);
} }
int Rectangle::getArea() int Rectangle::getArea() {
{
return (x1 - x0) * (y1 - y0); return (x1 - x0) * (y1 - y0);
} }
void Rectangle::move(int dx, int dy) void Rectangle::move(int dx, int dy) {
{
x0 += dx; x0 += dx;
y0 += dy; y0 += dy;
x1 += dx; x1 += dx;
y1 += dy; y1 += dy;
} }
}
This is pretty dumb, but should suffice to demonstrate the steps involved. This is pretty dumb, but should suffice to demonstrate the steps involved.
Specify C++ language in setup.py Specify C++ language in setup.py
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment